aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sl/slc-gram.y
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sl/slc-gram.y')
-rw-r--r--lib/sl/slc-gram.y18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/sl/slc-gram.y b/lib/sl/slc-gram.y
index 530b1a344776..31ec6bc24de4 100644
--- a/lib/sl/slc-gram.y
+++ b/lib/sl/slc-gram.y
@@ -328,6 +328,7 @@ gen_command(struct assignment *as)
cprint(1, " { ");
fprintf(cfile, "\"%s\", ", a->u.value);
fprintf(cfile, "%s_wrap, ", f);
+ free(f);
b = find(as, "argument");
if(b)
fprintf(cfile, "\"%s %s\", ", a->u.value, b->u.value);
@@ -341,7 +342,7 @@ gen_command(struct assignment *as)
fprintf(cfile, " },\n");
for(a = a->next; a != NULL; a = a->next)
if(strcmp(a->name, "name") == 0)
- cprint(1, " { \"%s\" },\n", a->u.value);
+ cprint(1, " { \"%s\", NULL, NULL, NULL },\n", a->u.value);
cprint(0, "\n");
}
@@ -360,6 +361,7 @@ make_name(struct assignment *as)
struct assignment *lopt;
struct assignment *type;
char *s;
+ int ret;
lopt = find(as, "long");
if(lopt == NULL)
@@ -369,9 +371,11 @@ make_name(struct assignment *as)
type = find(as, "type");
if(strcmp(type->u.value, "-flag") == 0)
- asprintf(&s, "%s_flag", lopt->u.value);
+ ret = asprintf(&s, "%s_flag", lopt->u.value);
else
- asprintf(&s, "%s_%s", lopt->u.value, type->u.value);
+ ret = asprintf(&s, "%s_%s", lopt->u.value, type->u.value);
+ if (ret == -1)
+ return NULL;
gen_name(s);
return s;
}
@@ -446,7 +450,7 @@ struct type_handler {
defval_neg_flag,
NULL
},
- { NULL }
+ { NULL, NULL, NULL, NULL, NULL }
};
static struct type_handler *find_handler(struct assignment *type)
@@ -710,7 +714,7 @@ gen(struct assignment *as)
cprint(0, "SL_cmd commands[] = {\n");
for(a = as; a != NULL; a = a->next)
gen_command(a->u.assignment);
- cprint(1, "{ NULL }\n");
+ cprint(1, "{ NULL, NULL, NULL, NULL }\n");
cprint(0, "};\n");
hprint(0, "extern SL_cmd commands[];\n");
@@ -719,8 +723,8 @@ gen(struct assignment *as)
int version_flag;
int help_flag;
struct getargs args[] = {
- { "version", 0, arg_flag, &version_flag },
- { "help", 0, arg_flag, &help_flag }
+ { "version", 0, arg_flag, &version_flag, NULL, NULL },
+ { "help", 0, arg_flag, &help_flag, NULL, NULL }
};
int num_args = sizeof(args) / sizeof(args[0]);