summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gfx/fig.c19
-rw-r--r--main/eeplot.c4
2 files changed, 12 insertions, 11 deletions
diff --git a/gfx/fig.c b/gfx/fig.c
index 96f9ea2..dbc9dff 100644
--- a/gfx/fig.c
+++ b/gfx/fig.c
@@ -271,26 +271,27 @@ static bool fig_args(void *ctx, int argc, char *const *argv)
const char **vars = NULL;
int n_vars = 0;
char c;
- int arg;
FILE *file;
int lines_to_colors = 8;
- while ((c = getopt(argc, argv, "t:")) != EOF)
+ while ((c = getopt(argc, argv, "t:D:")) != EOF)
switch (c) {
case 't':
template = optarg;
break;
+ case 'D':
+ if (!strchr(optarg, '='))
+ usage(*argv);
+ n_vars++;
+ vars = realloc_type_n(vars, const char *, n_vars);
+ vars[n_vars - 1] = optarg;
+ break;
default:
usage(*argv);
}
- for (arg = optind; arg != argc; arg++) {
- if (!strchr(argv[arg], '='))
- usage(*argv);
- n_vars++;
- vars = realloc_type_n(vars, const char *, n_vars);
- vars[n_vars - 1] = argv[arg];
- }
+ if (argc != optind)
+ usage(*argv);
if (!template) {
fig_header();
diff --git a/main/eeplot.c b/main/eeplot.c
index 19c603a..68c4c6d 100644
--- a/main/eeplot.c
+++ b/main/eeplot.c
@@ -64,10 +64,10 @@ void usage(const char *name)
" gdb run eeshow under gdb\n"
"\n"
"FIG driver spec:\n"
-" fig [-t template.fig] [var=value ...]\n"
+" fig [-t template.fig] [-D var=value ...]\n"
"\n"
-" var=value substitute \"<var>\" with \"value\" in template\n"
" -t template.fig merge this file with generated output\n"
+" -D var=value substitute \"<var>\" with \"value\" in template\n"
"\n"
"Cairo PNG driver spec:\n"
" png [-o output.png] [-s scale]\n"