diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-12-11 12:42:06 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-12-11 14:34:51 +0200 |
commit | 2fe31259571d24cd06292946a2a108046d3bc228 (patch) | |
tree | bdcfd00fdde244761a8c6560becf615f1e6f4d66 /src/util.c | |
parent | 980d465d9ea87e2123bd9a3045de5c0a45e84cd7 (diff) | |
download | eclat-2fe31259571d24cd06292946a2a108046d3bc228.tar.gz eclat-2fe31259571d24cd06292946a2a108046d3bc228.tar.bz2 |
Change handler invocation.
* src/eclat.c: Initialize query in main and pass it to
each handler along with the curl pointer in a "runtime
environment" structure. If the handler returns 0, send
that query to the endpoint (from main, again). This
avoids duplication of code. Reserve a CMD_NOQRY flag
for commands that are supposed to do everything by
themselves. Use command->tag member as the Action
parameter.
* src/eclat.h (eclat_command_env): New structure.
Change all handler prototypes.
* src/util.c (describe_query_create): Take a pointer
to eclat_command_env_t as the first argument. Assume
that the query structure is already initialized. The
"verb" argument becomes superfluous and is removed. All
uses changed.
* src/allocaddr.c: Update.
* src/asscaddr.c: Update.
* src/attvol.c: Update.
* src/cresnap.c: Update.
* src/cretags.c: Update.
* src/crevol.c: Update.
* src/delsnap.c: Update.
* src/delvol.c: Update.
* src/detvol.c: Update.
* src/disassaddr.c: Update.
* src/dscraddrs.c: Update.
* src/dscrazs.c: Update.
* src/dscrinstattr.c: Update.
* src/dscrinsts.c: Update.
* src/dscrinststat.c: Update.
* src/dscrregs.c: Update.
* src/dscrsecgrps.c: Update.
* src/dscrsnap.c: Update.
* src/dscrtags.c: Update.
* src/dscrvols.c: Update.
* src/getconout.c: Update.
* src/reladdr.c: Update.
* src/startinst.c: Update.
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -138,21 +138,18 @@ get_scr_cols() } -struct ec2_query * -describe_query_create(CURL *curl, const char *verb, int argc, char **argv, - const char *uparm) +void +describe_query_create(eclat_command_env_t *env, int argc, char **argv, + const char *uparm) { int i, j, k; - struct ec2_query *q; + struct ec2_query *q = env->query; char *bufptr = NULL; size_t bufsize = 0; struct wordsplit ws; int wsflags; int upn = 0; - q = eclat_query_create(use_ssl ? EC2_QF_HTTPS : 0, endpoint, "/"); - eclat_query_add_param(q, "Action", verb); - ws.ws_delim = ","; wsflags = WRDSF_DEFFLAGS | WRDSF_DELIM; for (i = 0, j = 1; i < argc; i++) { @@ -185,8 +182,6 @@ describe_query_create(CURL *curl, const char *verb, int argc, char **argv, if (wsflags & WRDSF_REUSE) wordsplit_free(&ws); free(bufptr); - - return q; } int |