aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/eclat.122
m---------grecs0
-rw-r--r--lib/diag.c2
-rw-r--r--lib/filemap.c1
-rw-r--r--lib/forlan.c13
-rw-r--r--lib/forlangrm.y6
-rw-r--r--lib/forlanlex.l1
-rw-r--r--lib/ldapmap.c8
-rw-r--r--lib/libeclat.h4
-rw-r--r--lib/map.c1
-rw-r--r--lib/reqsign.c4
-rw-r--r--lib/urlencode.c4
-rw-r--r--lib/xmltree.c22
-rw-r--r--src/config.c1
-rw-r--r--src/dscrinsts.c2
-rw-r--r--src/eclat.c28
-rw-r--r--src/eclat.h2
-rw-r--r--src/startinst.c6
-rw-r--r--src/util.c6
-rw-r--r--tests/tforlan.c1
-rw-r--r--tests/thmac.c1
21 files changed, 46 insertions, 89 deletions
diff --git a/doc/eclat.1 b/doc/eclat.1
index cba7b2d..d2af06f 100644
--- a/doc/eclat.1
+++ b/doc/eclat.1
@@ -13,7 +13,7 @@
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with Eclat. If not, see <http://www.gnu.org/licenses/>.
-.TH ECLAT 1 "October 1, 2012" "ECLAT" "Eclat User Reference"
+.TH ECLAT 1 "October 11, 2012" "ECLAT" "Eclat User Reference"
.SH NAME
eclat \- EC2 Command Line Administrator Tool
.SH SYNOPSIS
@@ -155,8 +155,9 @@ would start the instance \fIi-1234beef\fR. It can be noted, that
identifiers are rather machine- than human-oriented. If you
have a number of resources, it is not easy to remember which
identifier corresponds to which resource. In the example above, one
-would rather prefer to identify the instance to be started by its DNS
-name, than by its ID. To make this possible,
+would rather prefer to identify the instance to be started by its
+functional name (say, "dbserver") or its DNS name, than by its ID. To
+make this possible,
.B eclat
provides a mapping feature.
.PP
@@ -181,6 +182,21 @@ will by default select a map named by the resource in question. For
example, when operating on an instance, the \fIInstanceId\fR map will
be used.
.PP
+For commands that support the \fRresource-id\fB filter, identifiers
+listed in that filter can be prefixed with the map name in order to
+request their translation. For example,
+.sp
+.nf
+.in +2
+eclat -x describe-tags resource-id=InstanceId:webserver
+.in
+.fi
+.sp
+will first translate the name "webserver" using the "InstanceId" map,
+and then will replace the entier "InstanceId:webserver" construct with
+the obtained identifier. See also
+.BR eclat-describe-tags (1).
+.PP
The name of the map to use can also be supplied explicitly, using the
\fI\-\-map\fR (\fI\-M\fR) option.
.PP
diff --git a/grecs b/grecs
-Subproject bef65e80588f71b1fe5247869e6cab20d334aa6
+Subproject 5ab7c300ddb876a6409f38c8b6167af0e939484
diff --git a/lib/diag.c b/lib/diag.c
index 5386abd..0e44491 100644
--- a/lib/diag.c
+++ b/lib/diag.c
@@ -40,8 +40,6 @@ vdiag(grecs_locus_t const *locus, const char *qual, const char *fmt,
fprintf(stderr, "%s: ", program_name);
if (locus) {
- size_t size = 0;
-
if (locus->beg.col == 0)
fprintf(stderr, "%s:%u",
locus->beg.file,
diff --git a/lib/filemap.c b/lib/filemap.c
index f1d726b..c43ba35 100644
--- a/lib/filemap.c
+++ b/lib/filemap.c
@@ -58,7 +58,6 @@ filemap_config(int dbg, struct grecs_node *node, void *data)
{
struct filemap *filemap, **return_filemap = data;
int i;
- const char *filename;
struct grecs_node *p;
filemap = grecs_malloc(sizeof(*filemap));
diff --git a/lib/forlan.c b/lib/forlan.c
index f1d49d7..e86189b 100644
--- a/lib/forlan.c
+++ b/lib/forlan.c
@@ -17,6 +17,7 @@
#include "libeclat.h"
#include <string.h>
#include <setjmp.h>
+#include <ctype.h>
#include "grecs.h"
#include "forlan.h"
@@ -321,7 +322,7 @@ eval_comp0(forlan_eval_env_t env, union forlan_node *p)
if (p->comp.root) {
forlan_eval(env, p->comp.root);
if (!retval_boolean(env))
- return;
+ return NULL;
coerce_retval(env, 'n');
root = env->retval.v.node;
} else
@@ -465,8 +466,6 @@ dump_stmt(FILE *fp, union forlan_node *p, int *num, int lev)
void
eval_stmt(forlan_eval_env_t env, union forlan_node *node)
{
- union forlan_node *np;
-
while (node && node->type == forlan_type_stmt) {
forlan_eval(env, node->stmt.stmt);
node = node->stmt.next;
@@ -637,9 +636,9 @@ dump_loop(FILE *fp, union forlan_node *p, int *num, int lev)
fprintf(fp, "LOOP %lu\n", (unsigned long) p->loop.idx);
fprintf(fp, "%04d: %*.*sEXPR\n", ++*num, lev, lev, "");
forlan_dump_node(fp, p->loop.node, num, lev + 1);
- fprintf(fp, "%04d: %*.*sSTMT %lu\n", ++*num, lev, lev, "", n);
+ fprintf(fp, "%04d: %*.*sSTMT %d\n", ++*num, lev, lev, "", n);
forlan_dump_node(fp, p->loop.stmt, num, lev + 1);
- fprintf(fp, "%04d: %*.*sEND LOOP %lu\n", ++*num, lev, lev, "", n);
+ fprintf(fp, "%04d: %*.*sEND LOOP %d\n", ++*num, lev, lev, "", n);
}
void
@@ -897,8 +896,8 @@ func_decode(forlan_eval_env_t env, struct grecs_list *list)
if (!*p)
break;
ilen = strcspn(p, " \t\f\n");
- eclat_base64_decode(p, ilen, &optr, &olen);
- grecs_txtacc_grow(acc, optr, olen);
+ eclat_base64_decode((unsigned char*) p, ilen, &optr, &olen);
+ grecs_txtacc_grow(acc, (char*)optr, olen);
free(optr);
p += ilen;
diff --git a/lib/forlangrm.y b/lib/forlangrm.y
index 5c91f1a..4d77df6 100644
--- a/lib/forlangrm.y
+++ b/lib/forlangrm.y
@@ -20,6 +20,7 @@
#include <grecs-locus.h>
#include "forlangrm.h"
#include "forlan.h"
+#include <string.h>
static int yyerror(char *);
union forlan_node *forlan_parse_tree;
@@ -36,11 +37,6 @@ struct path_component {
char *label;
};
-static void
-free_comp(void *p)
-{
- free(p);
-}
%}
%error-verbose
%locations
diff --git a/lib/forlanlex.l b/lib/forlanlex.l
index 8df6d80..1eecf93 100644
--- a/lib/forlanlex.l
+++ b/lib/forlanlex.l
@@ -17,6 +17,7 @@
#include "libeclat.h"
#include <sysexits.h>
+#include <ctype.h>
#include <grecs.h>
#include <grecs-locus.h>
#include "forlangrm.h"
diff --git a/lib/ldapmap.c b/lib/ldapmap.c
index 1f08179..4e780af 100644
--- a/lib/ldapmap.c
+++ b/lib/ldapmap.c
@@ -69,8 +69,6 @@ cb_tls(enum grecs_callback_command cmd,
return 0;
}
-static char *typestr;
-
static struct grecs_keyword ldapmap_kw[] = {
{ "type", "'ldap", "Set map type", grecs_type_null },
{ "key", "<arg: string>", "key expression", grecs_type_null },
@@ -248,7 +246,6 @@ parse_ldap_uri(const char *uri)
for (ludp = &ludlist; *ludp; ) {
LDAPURLDesc *lud = *ludp;
- char **tmp;
if (lud->lud_dn && lud->lud_dn[0]
&& (lud->lud_host == NULL || lud->lud_host[0] == '\0')) {
@@ -287,8 +284,6 @@ ldap_connect(int dbg, struct ldap_map *map)
char *ldapuri = NULL;
LDAP *ld = NULL;
int protocol = LDAP_VERSION3;
- char *val;
- unsigned long lval;
if (map->dbg) {
if (ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &map->dbg)
@@ -365,7 +360,6 @@ ldap_bind(int dbg, struct ldap_map *map)
char *info = NULL;
char **refs = NULL;
struct berval passwd;
- char *binddn;
msgbuf[0] = 0;
@@ -446,7 +440,6 @@ ldap_map_open(int dbg, void *data)
struct ldap_map *map = data;
char *user = NULL, *p;
uid_t uid = getuid();
- int i = 0;
struct passwd *pw;
const char *kw[3];
@@ -574,7 +567,6 @@ ldap_map_get(int dbg, void *data, const char *key, char **return_value)
char *attrs[2];
char **ret;
const char *kwe[3];
- struct wordsplit ws;
char *filter;
kwe[0] = "key";
diff --git a/lib/libeclat.h b/lib/libeclat.h
index 4a205a1..0843fb1 100644
--- a/lib/libeclat.h
+++ b/lib/libeclat.h
@@ -85,8 +85,10 @@ struct ec2_query {
struct ec2_query *eclat_query_create(int flags, const char *endpoint,
const char *uri);
void eclat_query_free(struct ec2_query *);
+void eclat_query_add_param(struct ec2_query *q, const char *name,
+ const char *value);
-int eclat_query_signature(struct ec2_query *req, char *secret);
+void eclat_query_signature(struct ec2_query *req, char *secret);
char *eclat_query_to_url(struct ec2_query *req, char **post_params);
diff --git a/lib/map.c b/lib/map.c
index f723cd9..461ead0 100644
--- a/lib/map.c
+++ b/lib/map.c
@@ -71,7 +71,6 @@ drv_copy(void *a, void *b)
int
eclat_map_drv_register(struct eclat_map_drv *drv)
{
- struct eclat_map_drv *p;
int install;
if (!mapdrv_symtab) {
diff --git a/lib/reqsign.c b/lib/reqsign.c
index 20c56a7..cee389d 100644
--- a/lib/reqsign.c
+++ b/lib/reqsign.c
@@ -42,7 +42,7 @@ compnames(const void *a, const void *b)
return strcmp(*ac, *bc);
}
-int
+void
eclat_query_signature(struct ec2_query *req, char *secret)
{
char **pnames;
@@ -104,7 +104,7 @@ eclat_query_signature(struct ec2_query *req, char *secret)
hmac_sha1(str, strlen(str), secret, strlen(secret), digest);
- eclat_base64_encode(digest, sizeof(digest),
+ eclat_base64_encode((unsigned char *)digest, sizeof(digest),
(unsigned char**) &req->signature, &siglen);
grecs_txtacc_free(acc);
diff --git a/lib/urlencode.c b/lib/urlencode.c
index a9cd68c..278a097 100644
--- a/lib/urlencode.c
+++ b/lib/urlencode.c
@@ -46,7 +46,7 @@ urlencode(const char *input, size_t len, char **poutput, size_t *poutlen)
outlen = len;
for (i = 0; i < len; i++)
- if (!prtch[input[i]])
+ if (!prtch[(unsigned char)input[i]])
outlen += 2;
if (poutlen)
@@ -56,7 +56,7 @@ urlencode(const char *input, size_t len, char **poutput, size_t *poutlen)
*poutput = output;
for (i = 0; i < len; i++) {
- if (prtch[input[i]])
+ if (prtch[(unsigned char)input[i]])
*output++ = input[i];
else {
*output++ = '%';
diff --git a/lib/xmltree.c b/lib/xmltree.c
index 6431d28..96a4d0a 100644
--- a/lib/xmltree.c
+++ b/lib/xmltree.c
@@ -16,6 +16,7 @@
#include <config.h>
#include "libeclat.h"
+#include <ctype.h>
#define NODEREF_TEXT 0x01 /* Text is being constructed */
@@ -65,27 +66,6 @@ eclat_partial_tree_finish(struct eclat_partial_tree *pt)
}
-static char *
-install_text(struct eclat_partial_tree *nref, const char *str)
-{
- struct grecs_syment key;
- struct grecs_syment *ent;
- int install = 1;
-
- if (!nref->texttab) {
- nref->texttab = grecs_symtab_create_default(
- sizeof(struct grecs_syment));
- if (!nref->texttab)
- grecs_alloc_die();
- }
-
- key.name = (char*) str;
- ent = grecs_symtab_lookup_or_install(nref->texttab, &key, &install);
- if (!ent)
- grecs_alloc_die();
- return ent->name;
-}
-
static struct grecs_node *
gettos(struct eclat_partial_tree *nref)
{
diff --git a/src/config.c b/src/config.c
index e781f34..0712110 100644
--- a/src/config.c
+++ b/src/config.c
@@ -119,6 +119,7 @@ cb_format(enum grecs_callback_command cmd,
set_command_format(value->v.arg.v[0]->v.string,
value->v.arg.v[1]->v.string,
&value->v.arg.v[1]->locus);
+ return 0;
}
static int
diff --git a/src/dscrinsts.c b/src/dscrinsts.c
index 865c2ce..81720aa 100644
--- a/src/dscrinsts.c
+++ b/src/dscrinsts.c
@@ -141,8 +141,6 @@ eclat_describe_instances(CURL *curl, int argc, char **argv)
{
int i;
struct ec2_query *q;
- CURLcode res;
- char *url;
parse_options(argc, argv, &i);
argv += i;
diff --git a/src/eclat.c b/src/eclat.c
index 7dd32e4..181391e 100644
--- a/src/eclat.c
+++ b/src/eclat.c
@@ -108,7 +108,7 @@ eclat_trace_fun(CURL *handle, curl_infotype type,
char *data, size_t size,
void *userp)
{
- struct data *config = (struct data *)userp;
+/* struct data *config = (struct data *)userp;*/
const char *text;
switch (type) {
@@ -142,25 +142,6 @@ eclat_trace_fun(CURL *handle, curl_infotype type,
}
static void
-dump_text(FILE *stream, int line, int column, const char *text, size_t len)
-{
- fprintf(stream, "%02d:%02d: ", line, column);
- while (len--) {
- char c = *text++;
- if (c == '\r')
- continue;
- fputc(c, stream);
- ++column;
- if (c == '\n') {
- ++line;
- column = 0;
- fprintf(stream, "%02d:%02d: ", line, column);
- }
- }
- fputc('\n', stream);
-}
-
-static void
dumpxml(void *ptr, size_t realsize)
{
static int open_failed = 0;
@@ -251,13 +232,6 @@ struct command cmdtab[] = {
};
size_t cmdcnt = sizeof(cmdtab) / sizeof(cmdtab[0]);
-static int
-cmdcmp(const void *a, const void *b)
-{
- struct command const *cmda = a, *cmdb = b;
- return strcmp(cmda->ident, cmdb->ident);
-}
-
void
listcmd()
{
diff --git a/src/eclat.h b/src/eclat.h
index 96068d9..bf98828 100644
--- a/src/eclat.h
+++ b/src/eclat.h
@@ -78,6 +78,8 @@ int eclat_describe_security_groups(CURL *curl, int argc, char **argv);
char *region_to_endpoint(const char *region);
void define_format(const char *name, const char *format, grecs_locus_t *locus);
+void set_command_format(const char *name, const char *format,
+ grecs_locus_t *locus);
struct ec2_query *describe_query_create(CURL *curl, const char *verb,
int argc, char **argv,
diff --git a/src/startinst.c b/src/startinst.c
index 3c34526..f1ace61 100644
--- a/src/startinst.c
+++ b/src/startinst.c
@@ -81,7 +81,7 @@ eclat_start_instance(CURL *curl, int argc, char **argv)
argc, argv, &i);
debug(ECLAT_DEBCAT_MAIN, 1, ("starting instances"));
- start_stop_instance(curl, "StartInstances", argc - i, argv + i);
+ return start_stop_instance(curl, "StartInstances", argc - i, argv + i);
}
int
@@ -94,7 +94,7 @@ eclat_stop_instance(CURL *curl, int argc, char **argv)
argc, argv, &i);
debug(ECLAT_DEBCAT_MAIN, 1, ("stopping instances"));
- start_stop_instance(curl, "StopInstances", argc - i, argv + i);
+ return start_stop_instance(curl, "StopInstances", argc - i, argv + i);
}
int
@@ -107,5 +107,5 @@ eclat_reboot_instance(CURL *curl, int argc, char **argv)
argc, argv, &i);
debug(ECLAT_DEBCAT_MAIN, 1, ("rebooting instances"));
- start_stop_instance(curl, "RebootInstances", argc - i, argv + i);
+ return start_stop_instance(curl, "RebootInstances", argc - i, argv + i);
}
diff --git a/src/util.c b/src/util.c
index f61432d..b4af99f 100644
--- a/src/util.c
+++ b/src/util.c
@@ -26,7 +26,7 @@ translate_ids(int argc, char **argv, const char *mapname)
{
int i;
struct eclat_map *map;
- char *val, *p;
+ char *val;
if (!translate_option)
return;
@@ -68,7 +68,7 @@ translate_resource_ids(int argc, char **argv)
int i, j, rc, ecnt;
size_t len;
struct eclat_map *map;
- char *val, *p, *mapname;
+ char *val, *p;
struct wordsplit ws;
int wsflags = WRDSF_DEFFLAGS|WRDSF_DELIM;
@@ -144,10 +144,8 @@ describe_query_create(CURL *curl, const char *verb, int argc, char **argv,
{
int i, j, k;
struct ec2_query *q;
- char *url;
char *bufptr = NULL;
size_t bufsize = 0;
- size_t bs;
struct wordsplit ws;
int wsflags;
int upn = 0;
diff --git a/tests/tforlan.c b/tests/tforlan.c
index 64f84e1..d785ae0 100644
--- a/tests/tforlan.c
+++ b/tests/tforlan.c
@@ -17,6 +17,7 @@
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
diff --git a/tests/thmac.c b/tests/thmac.c
index cda0777..074c139 100644
--- a/tests/thmac.c
+++ b/tests/thmac.c
@@ -18,6 +18,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
#include "libeclat.h"
char *progname;

Return to:

Send suggestions and report system problems to the System administrator.