diff options
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 | |||
@@ -70,7 +70,7 @@ OPTFILES=\ | |||
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\ |
@@ -98,12 +98,13 @@ 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 |
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 | |||
@@ -14,12 +14,7 @@ | |||
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>]) |
@@ -27,11 +22,10 @@ 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 | |||
@@ -23,7 +23,7 @@ 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 | ||
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 | |||
@@ -14,12 +14,8 @@ | |||
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>]) |
@@ -45,11 +41,11 @@ 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 | |||
@@ -26,7 +26,7 @@ eclat_associate_address(eclat_command_env_t *env, int argc, char **argv) | |||
26 | { | 26 | { |
27 | int i; | 27 | int i; |
28 | 28 | ||
29 | parse_options(argc, argv, &i); | 29 | parse_options(env, argc, argv, &i); |
30 | argc -= i; | 30 | argc -= i; |
31 | argv += i; | 31 | argv += i; |
32 | 32 | ||
diff --git a/src/cmdline.opt b/src/cmdline.opt index cd8c280..561d7e2 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt | |||
@@ -155,7 +155,7 @@ BEGIN | |||
155 | END | 155 | END |
156 | 156 | ||
157 | OPTION(sort,s,, | 157 | OPTION(sort,s,, |
158 | [<sort the returned XML teee prior to outputting it>]) | 158 | [<sort the returned XML tree prior to outputting it>]) |
159 | BEGIN | 159 | BEGIN |
160 | sort_option = 1; | 160 | sort_option = 1; |
161 | END | 161 | END |
diff --git a/src/cpimg-cl.opt b/src/cpimg-cl.opt index 4a01386..991c8af 100644 --- a/src/cpimg-cl.opt +++ b/src/cpimg-cl.opt | |||
@@ -19,12 +19,8 @@ char *image; | |||
19 | char *name; | 19 | char *name; |
20 | char *descr; | 20 | char *descr; |
21 | 21 | ||
22 | OPTIONS_COMMAND_BEGIN("eclat", | 22 | ECLAT_CL_BEGIN([<copy an AMI from another region>], |
23 | [<cpimg, copy-image>], | 23 | [<REGION AMI-ID>]) |
24 | [<copy an AMI from another region>], | ||
25 | [<REGION AMI-ID>], | ||
26 | [<gnu>], | ||
27 | [<noversion>]) | ||
28 | 24 | ||
29 | OPTION(name,n,[<NAME>], | 25 | OPTION(name,n,[<NAME>], |
30 | [<assign name to the new image>]) | 26 | [<assign name to the new image>]) |
@@ -40,10 +36,9 @@ END | |||
40 | 36 | ||
41 | /* FIXME: The idempotency token */ | 37 | /* FIXME: The idempotency token */ |
42 | 38 | ||
43 | OPTIONS_END | 39 | ECLAT_CL_END |
44 | 40 | ||
45 | static void | 41 | ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[]>],[< |
46 | parse_options(int argc, char *argv[]) | ||
47 | { | 42 | { |
48 | int idx; | 43 | int idx; |
49 | 44 | ||
@@ -56,3 +51,4 @@ parse_options(int argc, char *argv[]) | |||
56 | region = argv[0]; | 51 | region = argv[0]; |
57 | image = argv[1]; | 52 | image = argv[1]; |
58 | } | 53 | } |
54 | >]) | ||
diff --git a/src/cpimg.c b/src/cpimg.c index 53e7d3f..6822ed6 100644 --- a/src/cpimg.c +++ b/src/cpimg.c | |||
@@ -21,7 +21,7 @@ int | |||
21 | eclat_copy_image(eclat_command_env_t *env, int argc, char **argv) | 21 | eclat_copy_image(eclat_command_env_t *env, int argc, char **argv) |
22 | { | 22 | { |
23 | struct ec2_query *q = env->query; | 23 | struct ec2_query *q = env->query; |
24 | parse_options(argc, argv); |