diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-04-25 18:24:50 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-04-25 18:24:50 +0300 |
commit | e545233cb313c7a217c0839390a996744f92edf5 (patch) | |
tree | d6c731e8bb23dd8549dd1e512997dd59bd8380bb | |
parent | 6788b695b4fa8882fc20ccee6312977e0d8e8a81 (diff) | |
download | eclat-e545233cb313c7a217c0839390a996744f92edf5.tar.gz eclat-e545233cb313c7a217c0839390a996744f92edf5.tar.bz2 |
Provide additional m4 magic for creating cl interfaces.
* src/Makefile.am (EXTRA_DIST): Add eclatcl.m4
* src/eclatcl.m4: New file.
* src/detvol-cl.opt: Rename to src/devol-cl.opt
* src/cmdline.opt: Fix a typo
* src/allocaddr-cl.opt: Rewrite usning new m4 macros.
* src/asscaddr-cl.opt: Likewise.
* src/cpimg-cl.opt: Likewise.
* src/cpsnap-cl.opt: Likewise.
* src/disasaddr-cl.opt: Likewise.
* src/freeaddr-cl.opt: Likewise.
* src/lsaddr-cl.opt: Likewise.
* src/lsattr-cl.opt: Likewise.
* src/lsimg-cl.opt: Likewise.
* src/lsistat-cl.opt: Likewise.
* src/lssg-cl.opt: Likewise.
* src/lssnap-cl.opt: Likewise.
* src/lstag-cl.opt: Likewise.
* src/mkimg-cl.opt: Likewise.
* src/mkinst-cl.opt: Likewise.
* src/mktags-cl.opt: Likewise.
* src/mkvol-cl.opt: Likewise.
* src/allocaddr.c: Update calls to parse_options.
* src/asscaddr.c: Likewise.
* src/cpimg.c: Likewise.
* src/cpsnap.c: Likewise.
* src/devol.c: Likewise.
* src/disasaddr.c: Likewise.
* src/freeaddr.c: Likewise.
* src/lsaddr.c: Likewise.
* src/lsattr.c: Likewise.
* src/lsimg.c: Likewise.
* src/lsistat.c: Likewise.
* src/lssg.c: Likewise.
* src/lssnap.c: Likewise.
* src/lstag.c: Likewise.
* src/mkimg.c: Likewise.
* src/mkinst.c: Likewise.
* src/mktags.c: Likewise.
* src/mkvol.c: Likewise.
40 files changed, 159 insertions, 192 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index ee9eece..d97110a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -67,13 +67,13 @@ AM_CPPFLAGS = \ | |||
67 | 67 | ||
68 | OPTFILES=\ | 68 | OPTFILES=\ |
69 | allocaddr-cl.opt\ | 69 | allocaddr-cl.opt\ |
70 | asscaddr-cl.opt\ | 70 | asscaddr-cl.opt\ |
71 | cpimg-cl.opt\ | 71 | cpimg-cl.opt\ |
72 | cpsnap-cl.opt\ | 72 | cpsnap-cl.opt\ |
73 | detvol-cl.opt\ | 73 | devol-cl.opt\ |
74 | disasaddr-cl.opt\ | 74 | disasaddr-cl.opt\ |
75 | freeaddr-cl.opt\ | 75 | freeaddr-cl.opt\ |
76 | generic-cl.opt\ | 76 | generic-cl.opt\ |
77 | lsaddr-cl.opt\ | 77 | lsaddr-cl.opt\ |
78 | lsattr-cl.opt\ | 78 | lsattr-cl.opt\ |
79 | lsimg-cl.opt\ | 79 | lsimg-cl.opt\ |
@@ -95,18 +95,19 @@ BUILT_SOURCES=\ | |||
95 | xref.man | 95 | xref.man |
96 | 96 | ||
97 | EXTRA_DIST=\ | 97 | EXTRA_DIST=\ |
98 | cmdline.opt\ | 98 | cmdline.opt\ |
99 | $(OPTFILES)\ | 99 | $(OPTFILES)\ |
100 | comtab.man\ | 100 | comtab.man\ |
101 | xref.man | 101 | xref.man\ |
102 | eclatcl.m4 | ||
102 | 103 | ||
103 | SUFFIXES=.opt .c .h | 104 | SUFFIXES=.opt .c .h |
104 | 105 | ||
105 | .opt.h: | 106 | .opt.h: |
106 | $(AM_V_GEN)m4 -s $(top_srcdir)/grecs/build-aux/getopt.m4 $< | sed '1d' > $@ | 107 | $(AM_V_GEN)m4 -s $(top_srcdir)/grecs/build-aux/getopt.m4 eclatcl.m4 $< | sed '1d' > $@ |
107 | 108 | ||
108 | comtab.man: eclat.c | 109 | comtab.man: eclat.c |
109 | $(AM_V_GEN)$(top_srcdir)/src/eclat -l '\t\\fB%n\\fR\t\\fB%i\\fR\n' > comtab.man | 110 | $(AM_V_GEN)$(top_srcdir)/src/eclat -l '\t\\fB%n\\fR\t\\fB%i\\fR\n' > comtab.man |
110 | 111 | ||
111 | xref.man: eclat.c | 112 | xref.man: eclat.c |
112 | $(AM_V_GEN)$(top_srcdir)/src/eclat -l '%.BR eclat-: (1)n,\n' > xref.man | 113 | $(AM_V_GEN)$(top_srcdir)/src/eclat -l '%.BR eclat-: (1)n,\n' > xref.man |
diff --git a/src/allocaddr-cl.opt b/src/allocaddr-cl.opt index c618375..c29b4f3 100644 --- a/src/allocaddr-cl.opt +++ b/src/allocaddr-cl.opt | |||
@@ -11,27 +11,21 @@ | |||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ | 15 | along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ |
16 | 16 | ||
17 | OPTIONS_COMMAND_BEGIN("eclat", | 17 | ECLAT_CL_BEGIN([<allocate Elastic IP address>]) |
18 | [<allocaddr, allocate-address>], | ||
19 | [<allocate Elastic IP address>], | ||
20 | [<>], | ||
21 | [<gnu>], | ||
22 | [<noversion>]) | ||
23 | 18 | ||
24 | OPTION(vpc,v,, | 19 | OPTION(vpc,v,, |
25 | [<assign VPC addresses>]) | 20 | [<assign VPC addresses>]) |
26 | BEGIN | 21 | BEGIN |
27 | vpc = 1; | 22 | vpc = 1; |
28 | END | 23 | END |
29 | 24 | ||
30 | OPTIONS_END | 25 | ECLAT_CL_END |
31 | 26 | ||
32 | static void | 27 | ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[< |
33 | parse_options(int argc, char *argv[], int *index) | ||
34 | { | 28 | { |
35 | GETOPT(argc, argv, *index, exit(EX_USAGE)) | 29 | GETOPT(argc, argv, *index, exit(EX_USAGE)) |
36 | } | 30 | } |
37 | 31 | >]) | |
diff --git a/src/allocaddr.c b/src/allocaddr.c index 61736cd..51e58c3 100644 --- a/src/allocaddr.c +++ b/src/allocaddr.c | |||
@@ -20,13 +20,13 @@ static int vpc; | |||
20 | 20 | ||
21 | int | 21 | int |
22 | eclat_allocate_address(eclat_command_env_t *env, int argc, char **argv) | 22 | eclat_allocate_address(eclat_command_env_t *env, int argc, char **argv) |
23 | { | 23 | { |
24 | int i; | 24 | int i; |
25 | 25 | ||
26 | parse_options(argc, argv, &i); | 26 | parse_options(env, argc, argv, &i); |
27 | argc -= i; | 27 | argc -= i; |
28 | argv += i; | 28 | argv += i; |
29 | 29 | ||
30 | if (argc != 0) | 30 | if (argc != 0) |
31 | die(EX_USAGE, "wrong number of arguments to allocate-address"); | 31 | die(EX_USAGE, "wrong number of arguments to allocate-address"); |
32 | 32 | ||
diff --git a/src/asscaddr-cl.opt b/src/asscaddr-cl.opt index 87846e3..321f7c4 100644 --- a/src/asscaddr-cl.opt +++ b/src/asscaddr-cl.opt | |||
@@ -11,18 +11,14 @@ | |||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ | 15 | along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ |
16 | 16 | ||
17 | OPTIONS_COMMAND_BEGIN("eclat", | 17 | ECLAT_CL_BEGIN([<associate IP address with an instance>], |
18 | [<asscaddr, associate-address>], | 18 | [<INSTANCE IP-OR-ALLOC-ID>]); |
19 | [<associate IP address with an instance>], | ||
20 | [<INSTANCE IP-OR-ALLOC-ID>], | ||
21 | [<gnu>], | ||
22 | [<noversion>]) | ||
23 | 19 | ||
24 | OPTION(vpc,v,, | 20 | OPTION(vpc,v,, |
25 | [<assign VPC addresses>]) | 21 | [<assign VPC addresses>]) |
26 | BEGIN | 22 | BEGIN |
27 | vpc = 1; | 23 | vpc = 1; |
28 | END | 24 | END |
@@ -42,14 +38,14 @@ END | |||
42 | OPTION(allow-reassociation,A,, | 38 | OPTION(allow-reassociation,A,, |
43 | [<allow to reassociate an already associated address (vpc only)>]) | 39 | [<allow to reassociate an already associated address (vpc only)>]) |
44 | BEGIN | 40 | BEGIN |
45 | reassoc = 1; | 41 | reassoc = 1; |
46 | END | 42 | END |
47 | 43 | ||
48 | OPTIONS_END | 44 | ECLAT_CL_END |
49 | 45 | ||
50 | static void | 46 | ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[< |
51 | parse_options(int argc, char *argv[], int *index) | ||
52 | { | 47 | { |
53 | GETOPT(argc, argv, *index, exit(EX_USAGE)) | 48 | GETOPT(argc, argv, *index, exit(EX_USAGE)) |
54 | } | 49 | } |
50 | >]) | ||
55 | 51 | ||
diff --git a/src/asscaddr.c b/src/asscaddr.c index 859675b..8ec3998 100644 --- a/src/asscaddr.c +++ b/src/asscaddr.c | |||
@@ -23,13 +23,13 @@ static int reassoc; | |||
23 | 23 | ||
24 | int | 24 | int |
25 | eclat_associate_address(eclat_command_env_t *env, int argc, char **argv) | 25 | eclat_associate_address(eclat_command_env_t *env, int argc, char **argv) |
26 | { | 26 | { |
27 | int i; | 27 | int i; |
28 | 28 | ||