aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am7
-rw-r--r--src/allocaddr-cl.opt14
-rw-r--r--src/allocaddr.c2
-rw-r--r--src/asscaddr-cl.opt14
-rw-r--r--src/asscaddr.c2
-rw-r--r--src/cmdline.opt2
-rw-r--r--src/cpimg-cl.opt14
-rw-r--r--src/cpimg.c2
-rw-r--r--src/cpsnap-cl.opt14
-rw-r--r--src/cpsnap.c2
-rw-r--r--src/devol-cl.opt (renamed from src/detvol-cl.opt)14
-rw-r--r--src/devol.c4
-rw-r--r--src/disasaddr-cl.opt16
-rw-r--r--src/disasaddr.c2
-rw-r--r--src/eclat.h1
-rw-r--r--src/eclatcl.m436
-rw-r--r--src/freeaddr-cl.opt17
-rw-r--r--src/freeaddr.c2
-rw-r--r--src/lsaddr-cl.opt15
-rw-r--r--src/lsaddr.c2
-rw-r--r--src/lsattr-cl.opt14
-rw-r--r--src/lsattr.c2
-rw-r--r--src/lsimg-cl.opt17
-rw-r--r--src/lsimg.c2
-rw-r--r--src/lsistat-cl.opt15
-rw-r--r--src/lsistat.c2
-rw-r--r--src/lssg-cl.opt15
-rw-r--r--src/lssg.c2
-rw-r--r--src/lssnap-cl.opt16
-rw-r--r--src/lssnap.c2
-rw-r--r--src/lstag-cl.opt15
-rw-r--r--src/lstag.c2
-rw-r--r--src/mkimg-cl.opt14
-rw-r--r--src/mkimg.c2
-rw-r--r--src/mkinst-cl.opt15
-rw-r--r--src/mkinst.c2
-rw-r--r--src/mktags-cl.opt14
-rw-r--r--src/mktags.c2
-rw-r--r--src/mkvol-cl.opt14
-rw-r--r--src/mkvol.c2
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=\
asscaddr-cl.opt\
cpimg-cl.opt\
cpsnap-cl.opt\
- detvol-cl.opt\
+ devol-cl.opt\
disasaddr-cl.opt\
freeaddr-cl.opt\
generic-cl.opt\
@@ -98,12 +98,13 @@ 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
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 @@
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>])
@@ -27,11 +22,10 @@ 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
@@ -23,7 +23,7 @@ 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;
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 @@
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>])
@@ -45,11 +41,11 @@ 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
@@ -26,7 +26,7 @@ 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;
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
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
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;
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>])
@@ -40,10 +36,9 @@ 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;
@@ -56,3 +51,4 @@ parse_options(int argc, char *argv[])
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
@@ -21,7 +21,7 @@ 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);
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
@@ -18,12 +18,8 @@ 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>])
@@ -31,10 +27,9 @@ 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;
@@ -47,3 +42,4 @@ parse_options(int argc, char *argv[])
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
@@ -22,7 +22,7 @@ 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);
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
@@ -14,12 +14,8 @@
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>])
@@ -27,10 +23,10 @@ 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
@@ -16,7 +16,7 @@
#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)
@@ -24,7 +24,7 @@ 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;
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
@@ -14,23 +14,19 @@
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
@@ -24,7 +24,7 @@ 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;
diff --git a/src/eclat.h b/src/eclat.h
index d4d863f..e328b15 100644
--- a/src/eclat.h
+++ b/src/eclat.h
@@ -185,3 +185,4 @@ 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
@@ -14,12 +14,8 @@
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>])
@@ -27,11 +23,12 @@ 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
@@ -23,7 +23,7 @@ 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;
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
@@ -14,12 +14,8 @@
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>])
@@ -27,7 +23,7 @@ BEGIN
vpc = 1;
END
-OPTIONS_END
+ECLAT_CL_END
static char *domain_str[] = { "standard", "vpc", NULL };
static struct filter_descr filters[] = {
@@ -42,11 +38,10 @@ static struct filter_descr filters[] = {
{ 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
@@ -23,7 +23,7 @@ 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;
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
@@ -14,12 +14,8 @@
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>])
@@ -35,10 +31,10 @@ BEGIN
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
@@ -25,7 +25,7 @@ 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;
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
@@ -17,12 +17,8 @@
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>])
@@ -45,11 +41,11 @@ BEGIN
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 };
@@ -98,7 +94,8 @@ parse_options(struct ec2_query *q, int argc, char *argv[], int *idx)
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
@@ -22,7 +22,7 @@ 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;
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
@@ -14,12 +14,8 @@
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>])
@@ -27,10 +23,9 @@ 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",
@@ -101,7 +96,9 @@ parse_options(int argc, char *argv[], int *index)
FILTER_ENUM, instance_reachability },
{ NULL }
};
+
available_filters = filters;
proginfo.print_help_hook = list_filters;
GETOPT(argc, argv, *index, exit(EX_USAGE))
}
+>])
diff --git a/src/lsistat.c b/src/lsistat.c
index 00dd101..c9a518a 100644
--- a/src/lsistat.c
+++ b/src/lsistat.c
@@ -23,7 +23,7 @@ eclat_describe_instance_status(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;
translate_ids(argc, argv, "InstanceId");
diff --git a/src/lssg-cl.opt b/src/lssg-cl.opt
index 3898708..77dde5b 100644
--- a/src/lssg-cl.opt
+++ b/src/lssg-cl.opt
@@ -14,12 +14,8 @@
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",
- [<lssg, describe-security-groups>],
- [<returns information about security groups>],
- [<[FILTER...] [ID...]>],
- [<gnu>],
- [<noversion>])
+ECLAT_CL_BEGIN([<returns information about security groups>],
+ [<[FILTER...] [ID...]>])
OPTION(name,n,,
[<treat non-filter arguments as group names, instead of group IDs>])
@@ -27,7 +23,7 @@ BEGIN
name_option = 1;
END
-OPTIONS_END
+ECLAT_CL_END
static char *proto_str[] = {
"tcp", "udp", "icmp", "or a protocol number", NULL
@@ -49,11 +45,10 @@ static struct filter_descr filters[] = {
{ 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/lssg.c b/src/lssg.c
index d691f47..b3bd633 100644
--- a/src/lssg.c
+++ b/src/lssg.c
@@ -24,7 +24,7 @@ eclat_describe_security_groups(eclat_command_env_t *env, int argc, char **argv)
int i;
const char *resid = name_option ? "GroupName" : "GroupId";
- parse_options(argc, argv, &i);
+ parse_options(env, argc, argv, &i);
argv += i;
argc -= i;
translate_ids(argc, argv, resid);
diff --git a/src/lssnap-cl.opt b/src/lssnap-cl.opt
index be1f0d9..bb020ca 100644
--- a/src/lssnap-cl.opt
+++ b/src/lssnap-cl.opt
@@ -24,12 +24,8 @@ struct param {
static unsigned owner_idx = 1, rstby_idx = 1;
-OPTIONS_COMMAND_BEGIN("eclat",
- [<lssnap, describe-snapshots>],
- [<describe EC2 snapshots>],
- [<[SNAP-ID...] [FILTER...]]>],
- [<gnu>],
- [<noversion>])
+ECLAT_CL_BEGIN([<describe EC2 snapshots>],
+ [<[SNAP-ID...] [FILTER...]]>])
OPTION(owner,u,[<ID|self|amazon>],
[<return the snapshots owned by the specified owner>])
@@ -50,12 +46,12 @@ BEGIN
p->value = optarg;
grecs_list_append(parmlist, p);
END
+
+ECLAT_CL_END
-OPTIONS_END
-
-static void
-parse_options(int argc, char *argv[], int *index)
+ECLAT_CL_PARSER(parse_options, [<int argc, char *argv[], int *index>], [<
{
parmlist = grecs_list_create();
GETOPT(argc, argv, *index, exit(EX_USAGE))
}
+>])
diff --git a/src/lssnap.c b/src/lssnap.c
index 3494a8b..d60e048 100644
--- a/src/lssnap.c
+++ b/src/lssnap.c
@@ -48,7 +48,7 @@ eclat_describe_snapshots(eclat_command_env_t *env, int argc, char **argv)
available_filters = filters;
proginfo.print_help_hook = list_filters;
- parse_options(argc, argv, &i);
+ parse_options(env, argc, argv, &i);
argc -= i;
argv += i;
translate_ids(argc, argv, "SnapshotId");
diff --git a/src/lstag-cl.opt b/src/lstag-cl.opt
index af8064d..dfb8fc0 100644
--- a/src/lstag-cl.opt
+++ b/src/lstag-cl.opt
@@ -21,12 +21,8 @@ struct resource {
char *resid;
};
-OPTIONS_COMMAND_BEGIN("eclat",
- [<lstag, describe-tags>],
- [<List tags and their values>],
- [<[FILTER...]>],
- [<gnu>],
- [<noversion>])
+ECLAT_CL_BEGIN([<List tags and their values>],
+ [<[FILTER...]>])
OPTION(resource-id,r,[<[MAP:]ID>],
[<resource for which to list the tags>])
@@ -80,10 +76,9 @@ BEGIN
grecs_list_append(reslist, res);
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 *resource_types[] = {
"customer-gateway",
@@ -113,9 +108,11 @@ parse_options(int argc, char *argv[], int *index)
{ NULL }
};<