comparison main.c @ 122:64c4de3709de

Complain if -[DIU] is given an empty argument. (Like many compilers over the years, we don't accept the argument appearing in the next argv word.) Warn about this in the man page too.
author David A. Holland
date Tue, 11 Jun 2013 18:32:41 -0400
parents 2b0b61fd1a36
children eaae8014a94a
comparison
equal deleted inserted replaced
121:103acee239e0 122:64c4de3709de
132 commandline_def(const struct place *p, char *str) 132 commandline_def(const struct place *p, char *str)
133 { 133 {
134 struct place p2; 134 struct place p2;
135 char *val; 135 char *val;
136 136
137 if (*str == '\0') {
138 warnx("-D: macro name expected");
139 die();
140 }
141
137 val = strchr(str, '='); 142 val = strchr(str, '=');
138 if (val != NULL) { 143 if (val != NULL) {
139 *val = '\0'; 144 *val = '\0';
140 val++; 145 val++;
141 } 146 }
151 156
152 static 157 static
153 void 158 void
154 commandline_undef(const struct place *p, char *str) 159 commandline_undef(const struct place *p, char *str)
155 { 160 {
161 if (*str == '\0') {
162 warnx("-D: macro name expected");
163 die();
164 }
156 commandline_macro_add(p, str, p, NULL); 165 commandline_macro_add(p, str, p, NULL);
157 } 166 }
158 167
159 static 168 static
160 void 169 void
341 350
342 static 351 static
343 void 352 void
344 commandline_addincpath(struct stringarray *arr, char *s) 353 commandline_addincpath(struct stringarray *arr, char *s)
345 { 354 {
355 if (*s == '\0') {
356 warnx("Empty include path");
357 die();
358 }
346 stringarray_add(arr, s, NULL); 359 stringarray_add(arr, s, NULL);
347 } 360 }
348 361
349 static 362 static
350 void 363 void