# HG changeset patch # User David A. Holland # Date 1370989961 14400 # Node ID 64c4de3709de9574298b3ea80a45373fe9e57e96 # Parent 103acee239e05aa0c3d34784e655a29c14441756 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. diff -r 103acee239e0 -r 64c4de3709de main.c --- 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); } diff -r 103acee239e0 -r 64c4de3709de tradcpp.1 --- 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