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 = \ OPTFILES=\ allocaddr-cl.opt\ asscaddr-cl.opt\ cpimg-cl.opt\ cpsnap-cl.opt\ - detvol-cl.opt\ + devol-cl.opt\ disasaddr-cl.opt\ freeaddr-cl.opt\ generic-cl.opt\ lsaddr-cl.opt\ lsattr-cl.opt\ lsimg-cl.opt\ @@ -95,18 +95,19 @@ BUILT_SOURCES=\ xref.man EXTRA_DIST=\ cmdline.opt\ $(OPTFILES)\ comtab.man\ - xref.man + xref.man\ + eclatcl.m4 SUFFIXES=.opt .c .h .opt.h: - $(AM_V_GEN)m4 -s $(top_srcdir)/grecs/build-aux/getopt.m4 $< | sed '1d' > $@ + $(AM_V_GEN)m4 -s $(top_srcdir)/grecs/build-aux/getopt.m4 eclatcl.m4 $< | sed '1d' > $@ comtab.man: eclat.c $(AM_V_GEN)$(top_srcdir)/src/eclat -l '\t\\fB%n\\fR\t\\fB%i\\fR\n' > comtab.man xref.man: eclat.c $(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 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<allocaddr, allocate-address>], - [<allocate Elastic IP address>], - [<>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<allocate Elastic IP address>]) OPTION(vpc,v,, [<assign VPC addresses>]) BEGIN vpc = 1; END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[< { GETOPT(argc, argv, *index, exit(EX_USAGE)) } - +>]) 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; int eclat_allocate_address(eclat_command_env_t *env, int argc, char **argv) { int i; - parse_options(argc, argv, &i); + parse_options(env, argc, argv, &i); argc -= i; argv += i; if (argc != 0) die(EX_USAGE, "wrong number of arguments to allocate-address"); 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 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<asscaddr, associate-address>], - [<associate IP address with an instance>], - [<INSTANCE IP-OR-ALLOC-ID>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<associate IP address with an instance>], + [<INSTANCE IP-OR-ALLOC-ID>]); OPTION(vpc,v,, [<assign VPC addresses>]) BEGIN vpc = 1; END @@ -42,14 +38,14 @@ END OPTION(allow-reassociation,A,, [<allow to reassociate an already associated address (vpc only)>]) BEGIN reassoc = 1; END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[< { GETOPT(argc, argv, *index, exit(EX_USAGE)) } +>]) 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; int eclat_associate_address(eclat_command_env_t *env, int argc, char **argv) { int i; - parse_options(argc, argv, &i); + parse_options(env, argc, argv, &i); argc -= i; argv += i; if (argc != 2) die(EX_USAGE, "wrong number of arguments to associate-address"); diff --git a/src/cmdline.opt b/src/cmdline.opt index cd8c280..561d7e2 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -152,13 +152,13 @@ OPTION(format-file,F,FILE, ALIAS(formfile) BEGIN format_file_option = optarg; END OPTION(sort,s,, - [<sort the returned XML teee prior to outputting it>]) + [<sort the returned XML tree prior to outputting it>]) BEGIN sort_option = 1; END OPTION(yes,Y,, [<assume `yes' to all questions>]) 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 @@ -16,18 +16,14 @@ char *region; char *image; char *name; char *descr; -OPTIONS_COMMAND_BEGIN("eclat", - [<cpimg, copy-image>], - [<copy an AMI from another region>], - [<REGION AMI-ID>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<copy an AMI from another region>], + [<REGION AMI-ID>]) OPTION(name,n,[<NAME>], [<assign name to the new image>]) BEGIN name = optarg; END @@ -37,22 +33,22 @@ OPTION(description,d,[<DESCR>], BEGIN descr = optarg; END /* FIXME: The idempotency token */ -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[]) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[]>],[< { int idx; GETOPT(argc, argv, idx, exit(EX_USAGE)) argc -= idx; argv += idx; if (argc != 2) die(EX_USAGE, "bad number of arguments"); translate_ids(1, argv+1, "ImageId"); region = argv[0]; image = argv[1]; } +>]) diff --git a/src/cpimg.c b/src/cpimg.c index 53e7d3f..6822ed6 100644 --- a/src/cpimg.c +++ b/src/cpimg.c @@ -18,13 +18,13 @@ #include "cpimg-cl.h" int eclat_copy_image(eclat_command_env_t *env, int argc, char **argv) { struct ec2_query *q = env->query; - parse_options(argc, argv); + parse_options(env, argc, argv); eclat_query_add_param(q, "SourceRegion", region); eclat_query_add_param(q, "SourceImageId", image); if (name) eclat_query_add_param(q, "Name", name); if (descr) diff --git a/src/cpsnap-cl.opt b/src/cpsnap-cl.opt index 13423b5..e075264 100644 --- a/src/cpsnap-cl.opt +++ b/src/cpsnap-cl.opt @@ -15,35 +15,31 @@ along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ char *region; char *image; char *descr; -OPTIONS_COMMAND_BEGIN("eclat", - [<cpsnap, copy-snapshot>], - [<copy snapshot from another region>], - [<REGION SNAP-ID>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<copy snapshot from another region>], + [<REGION SNAP-ID>]) OPTION(description,d,[<DESCR>], [<description for the new image>]) BEGIN descr = optarg; END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[]) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[]>],[< { int idx; GETOPT(argc, argv, idx, exit(EX_USAGE)) argc -= idx; argv += idx; if (argc != 2) die(EX_USAGE, "bad number of arguments"); translate_ids(1, argv+1, "SnapshotId"); region = argv[0]; image = argv[1]; } +>]) diff --git a/src/cpsnap.c b/src/cpsnap.c index 2f0a624..97ca8b5 100644 --- a/src/cpsnap.c +++ b/src/cpsnap.c @@ -19,13 +19,13 @@ int eclat_copy_snapshot(eclat_command_env_t *env, int argc, char **argv) { struct ec2_query *q = env->query; - parse_options(argc, argv); + parse_options(env, argc, argv); eclat_query_add_param(q, "SourceRegion", region); eclat_query_add_param(q, "SourceSnapshotId", image); if (descr) eclat_query_add_param(q, "Description", descr); return 0; diff --git a/src/detvol-cl.opt b/src/devol-cl.opt index 2acf20b..f626f0d 100644 --- a/src/detvol-cl.opt +++ b/src/devol-cl.opt @@ -11,26 +11,22 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<devol, detach-volume>], - [<detach a volume from instance>], - [<VOL-ID [INST-ID [DEV-NAME]]>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<detach a volume from instance>], + [<VOL-ID [INST-ID [DEV-NAME]]>]) OPTION(force,f,, [<force detachment>]) BEGIN force = 1; END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[< { GETOPT(argc, argv, *index, exit(EX_USAGE)) } +>]) diff --git a/src/devol.c b/src/devol.c index c4642f8..b575352 100644 --- a/src/devol.c +++ b/src/devol.c @@ -13,21 +13,21 @@ You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ #include "eclat.h" int force; -#include "detvol-cl.h" +#include "devol-cl.h" int eclat_detach_volume(eclat_command_env_t *env, int argc, char **argv) { int i; struct ec2_query *q = env->query; - parse_options(argc, argv, &i); + parse_options(env, argc, argv, &i); argc -= i; argv += i; if (argc < 1 || argc > 3) die(EX_USAGE, "bad number of arguments"); diff --git a/src/disasaddr-cl.opt b/src/disasaddr-cl.opt index 0695387..949b05a 100644 --- a/src/disasaddr-cl.opt +++ b/src/disasaddr-cl.opt @@ -11,26 +11,22 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<disasadr, disassociate-address>], - [<disassociate IP address from instance>], - [<IP-OR-ALLOC-ID>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<disassociate IP address from instance>], + [<IP-OR-ALLOC-ID>]) OPTION(vpc,v,, [<disassociate VPC address>]) BEGIN vpc = 1; END -OPTIONS_END -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_END + +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>], [< { GETOPT(argc, argv, *index, exit(EX_USAGE)) } - +>]) diff --git a/src/disasaddr.c b/src/disasaddr.c index 93492f4..c739218 100644 --- a/src/disasaddr.c +++ b/src/disasaddr.c @@ -21,13 +21,13 @@ static int vpc; int eclat_disassociate_address(eclat_command_env_t *env, int argc, char **argv) { int i; struct ec2_query *q = env->query; - parse_options(argc, argv, &i); + parse_options(env, argc, argv, &i); argc -= i; argv += i; if (argc != 1) die(EX_USAGE, "wrong number of arguments to disassociate-address"); diff --git a/src/eclat.h b/src/eclat.h index d4d863f..e328b15 100644 --- a/src/eclat.h +++ b/src/eclat.h @@ -182,6 +182,7 @@ void generic_parse_options(struct eclat_command const *command, const char *docstring, int argc, char *argv[], int *index); extern struct grecs_proginfo *generic_proginfo; void set_command_confirmation(const char *name, enum eclat_confirm_mode cfmode, grecs_locus_t *locus); + diff --git a/src/eclatcl.m4 b/src/eclatcl.m4 new file mode 100644 index 0000000..7f688cb --- /dev/null +++ b/src/eclatcl.m4 @@ -0,0 +1,36 @@ +/* This file is part of Eclat. + Copyright (C) 2012, 2013 Sergey Poznyakoff. + + Eclat is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + Eclat is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ + +define([<ECLAT_CL_BEGIN>],[< +OPTIONS_COMMAND_BEGIN("eclat", + [<>], + [<$1>], + [<$2>], + [<gnu>], + [<noversion>])>]) + +define([<ECLAT_CL_END>],[<OPTIONS_END>]) + +define([<ECLAT_CL_PARSER>],[< +static void +$1(eclat_command_env_t *env, $2) +{ + const char *cmds[3] = { env->cmd->name, env->cmd->ident, NULL }; + proginfo.subcmd = (char**) cmds; + $3 +} +>]) + diff --git a/src/freeaddr-cl.opt b/src/freeaddr-cl.opt index 5f3a3f9..be70065 100644 --- a/src/freeaddr-cl.opt +++ b/src/freeaddr-cl.opt @@ -11,27 +11,24 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<freeaddr, release-address>], - [<release Elastic IP address>], - [<IP-OR-ALLOCID>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<release Elastic IP address>], + [<IP-OR-ALLOCID>]) OPTION(vpc,v,, [<assign VPC addresses>]) BEGIN vpc = 1; END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>], +[< { GETOPT(argc, argv, *index, exit(EX_USAGE)) } - +>]) + diff --git a/src/freeaddr.c b/src/freeaddr.c index 2cb2ce6..b970248 100644 --- a/src/freeaddr.c +++ b/src/freeaddr.c @@ -20,13 +20,13 @@ static int vpc; int eclat_release_address(eclat_command_env_t *env, int argc, char **argv) { int i; - parse_options(argc, argv, &i); + parse_options(env, argc, argv, &i); argc -= i; argv += i; if (argc != 1) die(EX_USAGE, "wrong number of arguments to release-address"); diff --git a/src/lsaddr-cl.opt b/src/lsaddr-cl.opt index 071bb27..c663f51 100644 --- a/src/lsaddr-cl.opt +++ b/src/lsaddr-cl.opt @@ -11,26 +11,22 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<lsaddr, describe-addresses>], - [<describe elastic IP addresses>], - [<[FILTER...]>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<describe elastic IP addresses>], + [<[FILTER...]>]) OPTION(vpc,v,, [<describe VPC addresses>]) BEGIN vpc = 1; END -OPTIONS_END +ECLAT_CL_END static char *domain_str[] = { "standard", "vpc", NULL }; static struct filter_descr filters[] = { { "domain", FILTER_ENUM, domain_str }, { "instance-id", FILTER_STRING }, { "public-ip", FILTER_STRING }, @@ -39,14 +35,13 @@ static struct filter_descr filters[] = { { "network-interface-id", FILTER_STRING }, { "network-interface-owner-id", FILTER_STRING }, { "private-ip-address", FILTER_STRING }, { NULL } }; -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>], [< { available_filters = filters; proginfo.print_help_hook = list_filters; GETOPT(argc, argv, *index, exit(EX_USAGE)) } - +>]) diff --git a/src/lsaddr.c b/src/lsaddr.c index 09541ad..0c192d7 100644 --- a/src/lsaddr.c +++ b/src/lsaddr.c @@ -20,13 +20,13 @@ static int vpc = 0; int eclat_describe_addresses(eclat_command_env_t *env, int argc, char **argv) { int i; - parse_options(argc, argv, &i); + parse_options(env, argc, argv, &i); argv += i; argc -= i; describe_query_create(env, argc, argv, vpc ? "AllocationId" : "PublicIp"); return 0; diff --git a/src/lsattr-cl.opt b/src/lsattr-cl.opt index a50deb6..0f3c4ab 100644 --- a/src/lsattr-cl.opt +++ b/src/lsattr-cl.opt @@ -11,18 +11,14 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<lsattr>], - [<List EC2 resource attributes>], - [<ID [ATTR]>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<List EC2 resource attributes>], + [<ID [ATTR]>]) OPTION(instance,i,, [<instance ID>]) BEGIN cmdname = "lsiattr"; idname = "InstanceId"; @@ -32,13 +28,13 @@ OPTION(snapshot,s,, [<snapshot ID>]) BEGIN cmdname = "lssattr"; idname = "SnapshotId"; END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>],[< { GETOPT(argc, argv, *index, exit(EX_USAGE)) } +>]) diff --git a/src/lsattr.c b/src/lsattr.c index 706be6b..9b49ca3 100644 --- a/src/lsattr.c +++ b/src/lsattr.c @@ -22,13 +22,13 @@ char *cmdname; int eclat_lsattr(eclat_command_env_t *env, int argc, char **argv) { int i; struct eclat_command *command; - parse_options(argc, argv, &i); + parse_options(env, argc, argv, &i); argc -= i; argv += i; if (argc < 1) die(EX_USAGE, "wrong number of arguments"); diff --git a/src/lsimg-cl.opt b/src/lsimg-cl.opt index 955b960..57bfb0c 100644 --- a/src/lsimg-cl.opt +++ b/src/lsimg-cl.opt @@ -14,18 +14,14 @@ You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ static int owner_n; static int xby_n; -OPTIONS_COMMAND_BEGIN("eclat", - [<lsimg, describe-images>], - [<describe Amazon images>], - [<[FILTER...] [AMI...]>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<describe Amazon images>], + [<[FILTER...] [AMI...]>]) OPTION(all,a,, [<describe all images>]) BEGIN grecs_asprintf(&bufptr, &bufsize, "Owner.%d", ++owner_n); eclat_query_add_param(q, bufptr, "all"); @@ -42,17 +38,17 @@ OPTION(executable-by, x, [<ID|all|self>], [<select images executable by the given user>]) BEGIN grecs_asprintf(&bufptr, &bufsize, "ExecutableBy.%d", ++xby_n); eclat_query_add_param(q, bufptr, optarg); END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(struct ec2_query *q, int argc, char *argv[], int *idx) +ECLAT_CL_PARSER(parse_options,[<int argc, char *argv[], int *idx>], [< { + struct ec2_query *q = env->query; char *bufptr = NULL; size_t bufsize = 0; static char *arch[] = { "i386", "x86_64", NULL }; static char *voltype[] = { "standard", "io1", NULL }; static char *imgtype[] = { "machine", "kernel", "ramdisk", NULL }; static char *prodcode[] = { "devpay", "marketplace", NULL }; @@ -95,10 +91,11 @@ parse_options(struct ec2_query *q, int argc, char *argv[], int *idx) available_filters = filters; proginfo.print_help_hook = list_filters; GETOPT(argc, argv, *idx, exit(EX_USAGE)) free(bufptr); } - +>] +) diff --git a/src/lsimg.c b/src/lsimg.c index 4be377b..db3c98b 100644 --- a/src/lsimg.c +++ b/src/lsimg.c @@ -19,13 +19,13 @@ int eclat_describe_images(eclat_command_env_t *env, int argc, char **argv) { int i; - parse_options(env->query, argc, argv, &i); + parse_options(env, argc, argv, &i); argc -= i; argv += i; translate_ids(argc, argv, "ImageId"); describe_query_create(env, argc, argv, "ImageId"); diff --git a/src/lsistat-cl.opt b/src/lsistat-cl.opt index 2807b73..470f570 100644 --- a/src/lsistat-cl.opt +++ b/src/lsistat-cl.opt @@ -11,29 +11,24 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eclat. If not, see <http://www.gnu.org/licenses/>. */ -OPTIONS_COMMAND_BEGIN("eclat", - [<lsistat, describe-instance-status>], - [<describe the status of Amazon EC2 instances including any scheduled events>], - [<[FILTER...]>], - [<gnu>], - [<noversion>]) +ECLAT_CL_BEGIN([<describe the status of Amazon EC2 instances including any scheduled events>], + [<[FILTER...]>]) OPTION(all,a,, [<return the health status for all instances>]) BEGIN all_option = 1; END -OPTIONS_END +ECLAT_CL_END -static void -parse_options(int argc, char *argv[], int *index) +ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>], [< { static char *event_codes[] = { "instance-reboot", "system-reboot", "system-maintenance", "instance-retirement", @@ -98,10 +93,12 @@ parse_options(int argc, char *argv[], int *index) { "instance-status.status", FILTER_ENUM, instance_status }, { "instance-status. |