summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2013-04-25 15:24:50 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2013-04-25 15:24:50 (GMT)
commite545233cb313c7a217c0839390a996744f92edf5 (patch) (side-by-side diff)
treed6c731e8bb23dd8549dd1e512997dd59bd8380bb
parent6788b695b4fa8882fc20ccee6312977e0d8e8a81 (diff)
downloadeclat-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.
Diffstat (more/less context) (ignore whitespace changes)
-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 (copied 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.m4 (renamed from src/detvol-cl.opt)26
-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, 136 insertions, 205 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/detvol-cl.opt b/src/eclatcl.m4
index 2acf20b..7f688cb 100644
--- a/src/detvol-cl.opt
+++ b/src/eclatcl.m4
@@ -14,23 +14,23 @@
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",
- [<devol, detach-volume>],
- [<detach a volume from instance>],
- [<VOL-ID [INST-ID [DEV-NAME]]>],
+ [<>],
+ [<$1>],
+ [<$2>],
[<gnu>],
- [<noversion>])
+ [<noversion>])>])
-OPTION(force,f,,
- [<force detachment>])
-BEGIN
- force = 1;
-END
-
-OPTIONS_END
+define([<ECLAT_CL_END>],[<OPTIONS_END>])
+define([<ECLAT_CL_PARSER>],[<
static void
-parse_options(int argc, char *argv[], int *index)
+$1(eclat_command_env_t *env, $2)
{
- GETOPT(argc, argv, *index, exit(EX_USAGE))
+ 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 }
};
+
available_filters = filters;
proginfo.print_help_hook = list_filters;
reslist = grecs_list_create();
GETOPT(argc, argv, *index, exit(EX_USAGE))
}
+>])
diff --git a/src/lstag.c b/src/lstag.c
index 49c165b..5532294 100644
--- a/src/lstag.c
+++ b/src/lstag.c
@@ -26,7 +26,7 @@ eclat_describe_tags(eclat_command_env_t *env, int argc, char **argv)
struct grecs_list_entry *ep;
int n = 1;
- parse_options(argc, argv, &i);
+ parse_options(env, argc, argv, &i);
argv += i;
argc -= i;
translate_resource_ids(argc, argv);
diff --git a/src/mkimg-cl.opt b/src/mkimg-cl.opt
index d905773..bb3fc42 100644
--- a/src/mkimg-cl.opt
+++ b/src/mkimg-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",
- [<mkimg, create-image>],
- [<create an AMI>],
- [<NAME INSTANCE>],
- [<gnu>],
- [<noversion>])
+ECLAT_CL_BEGIN([<create an AMI>],
+ [<NAME INSTANCE>])
OPTION(description,d,[<STRING>],
[<image description>])
@@ -43,10 +39,10 @@ BEGIN
grecs_list_append(devmap, optarg);
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/mkimg.c b/src/mkimg.c
index 021dce9..a34c302 100644
--- a/src/mkimg.c
+++ b/src/mkimg.c
@@ -26,7 +26,7 @@ eclat_create_image(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 != 2)
diff --git a/src/mkinst-cl.opt b/src/mkinst-cl.opt
index 15778d1..62654f0 100644
--- a/src/mkinst-cl.opt
+++ b/src/mkinst-cl.opt
@@ -61,12 +61,8 @@ read_user_data(const char *file)
user_data[st.st_size] = 0;
}
-OPTIONS_COMMAND_BEGIN("eclat",
- [<mkinst, run-instances>],
- [<launch new instances>],
- [<AMI-ID>],
- [<gnu>],
- [<noversion>])
+ECLAT_CL_BEGIN([<launch new instances>],
+ [<AMI-ID>])
OPTION(,n,[<N>],
[<number of instances to launch>])
@@ -218,14 +214,15 @@ BEGIN
ebs_opt = 1;
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))
if (idx != argc-1)
die(EX_USAGE, "bad number of arguments");
ami = argv[idx];
}
+>])
diff --git a/src/mkinst.c b/src/mkinst.c
index 8871f0e..359ad7b 100644
--- a/src/mkinst.c
+++ b/src/mkinst.c
@@ -138,7 +138,7 @@ eclat_run_instances(eclat_command_env_t *env, int argc, char **argv)
char *p;
int iface_no = 1;
- parse_options(argc, argv);
+ parse_options(env, argc, argv);
eclat_query_add_param(q, "ImageId", ami);
p = strchr(instance_count, '-');
diff --git a/src/mktags-cl.opt b/src/mktags-cl.opt
index 9da23ae..e622db8 100644
--- a/src/mktags-cl.opt
+++ b/src/mktags-cl.opt
@@ -22,12 +22,8 @@ struct resource {
char *resid;
};
-OPTIONS_COMMAND_BEGIN("eclat",
- [<mktags, create-tags>],
- [<create tags for the specified resources>],
- [<TAG[=VALUE] [TAG[=VALUE...]]>],
- [<gnu>],
- [<noversion>])
+ECLAT_CL_BEGIN([<create tags for the specified resources>],
+ [<TAG[=VALUE] [TAG[=VALUE...]]>])
OPTION(resource-id,r,[<[MAP:]ID>],
[<resource for which to create the tags>])
@@ -87,11 +83,11 @@ BEGIN
from_file = optarg;
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>],[<
{
reslist = grecs_list_create();
GETOPT(argc, argv, *index, exit(EX_USAGE))
}
+>])
diff --git a/src/mktags.c b/src/mktags.c
index 3a7a272..1d6f551 100644
--- a/src/mktags.c
+++ b/src/mktags.c
@@ -28,7 +28,7 @@ process_tags(eclat_command_env_t *env, int argc, char **argv, int require_tags)
if (!require_tags)
proginfo.args_doc = "[TAG[=VALUE...]]";
- parse_options(argc, argv, &i);
+ parse_options(env, argc, argv, &i);
argv += i;
argc -= i;
diff --git a/src/mkvol-cl.opt b/src/mkvol-cl.opt
index 1f21637..c79d612 100644
--- a/src/mkvol-cl.opt
+++ b/src/mkvol-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",
- [<mkvol, create-volume>],
- [<create EC2 volume>],
- [<SIZE ZONE>],
- [<gnu>],
- [<noversion>])
+ECLAT_CL_BEGIN([<create EC2 volume>],
+ [<SIZE ZONE>])
OPTION(iops,i,[<IOPS>],
[<number of I/O operations per second>])
@@ -36,10 +32,10 @@ BEGIN
snapshot = optarg;
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/mkvol.c b/src/mkvol.c
index 265f012..a2f4921 100644
--- a/src/mkvol.c
+++ b/src/mkvol.c
@@ -26,7 +26,7 @@ eclat_create_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 != 2)

Return to:

Send suggestions and report system problems to the System administrator.