summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-03 11:06:04 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-03 22:18:29 (GMT)
commit94929517d4f82a655c1cdcd854569eec8d16f6c5 (patch)
tree93258585ce94d1675f962cd4089f18ab0dce176b /gfx
parenta150ffdb0c068e5e340e0a60a46b21d3dad66ab2 (diff)
downloadeeshow-94929517d4f82a655c1cdcd854569eec8d16f6c5.zip
eeshow-94929517d4f82a655c1cdcd854569eec8d16f6c5.tar.gz
eeshow-94929517d4f82a655c1cdcd854569eec8d16f6c5.tar.bz2
gfx/fig.c (fig_args): var=value is now -D var=value
Diffstat (limited to 'gfx')
-rw-r--r--gfx/fig.c19
1 files changed, 10 insertions, 9 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();