Mercurial > ~dholland > hg > tradcpp > index.cgi
changeset 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 | 103acee239e0 |
children | 9f479b52364a |
files | main.c tradcpp.1 |
diffstat | 2 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Tue Jun 11 18:02:13 2013 -0400 +++ b/main.c Tue Jun 11 18:32:41 2013 -0400 @@ -134,6 +134,11 @@ struct place p2; char *val; + if (*str == '\0') { + warnx("-D: macro name expected"); + die(); + } + val = strchr(str, '='); if (val != NULL) { *val = '\0'; @@ -153,6 +158,10 @@ void commandline_undef(const struct place *p, char *str) { + if (*str == '\0') { + warnx("-D: macro name expected"); + die(); + } commandline_macro_add(p, str, p, NULL); } @@ -343,6 +352,10 @@ void commandline_addincpath(struct stringarray *arr, char *s) { + if (*s == '\0') { + warnx("Empty include path"); + die(); + } stringarray_add(arr, s, NULL); }
--- a/tradcpp.1 Tue Jun 11 18:02:13 2013 -0400 +++ b/tradcpp.1 Tue Jun 11 18:32:41 2013 -0400 @@ -77,8 +77,18 @@ If no expansion is provided, the value .Dq 1 is used. +Note that like many Unix compilers, +.Nm +does not accept a space between the +.Dq D +and the macro name. .It Fl Ipath Add the specified path to the main list of include directories. +Note that like many Unix compilers, +.Nm +does not accept a space between the +.Dq I +and the directory name. .It Fl nostdinc Do not search the standard system include directories. .It Fl P @@ -87,6 +97,11 @@ option has no effect. .It Fl Umacro Remove any existing defintion for the named macro. +Note that like many Unix compilers, +.Nm +does not accept a space between the +.Dq U +and the macro name. .It Fl undef Remove all predefined macros. .El