From: eck Date: Wed, 18 Apr 1990 13:09:36 +0000 (+0000) Subject: two -D options for one identifier didn't work X-Git-Tag: release-5-5~1739 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=52f08181a62a0da99f91ba30305096dcc1061aa1;p=ack.git two -D options for one identifier didn't work --- diff --git a/lang/cem/cemcom.ansi/options.c b/lang/cem/cemcom.ansi/options.c index 7572077f9..19878b040 100644 --- a/lang/cem/cemcom.ansi/options.c +++ b/lang/cem/cemcom.ansi/options.c @@ -104,6 +104,7 @@ deleted, is now a debug-flag case 'D' : { /* -Dname : predefine name */ #ifndef NOPP register char *cp = text, *name, *mactext; + unsigned maclen; if (class(*cp) != STIDF && class(*cp) != STELL) { error("identifier missing in -D%s", text); @@ -117,20 +118,21 @@ deleted, is now a debug-flag } if (!*cp) { /* -Dname */ - mactext = "1"; + maclen = 1; + mactext = Salloc("1", 2); } else if (*cp == '=') { /* -Dname=text */ *cp++ = '\0'; /* end of name */ - mactext = cp; + maclen = (unsigned) strlen(cp); + mactext = Salloc(cp, maclen + 1); } else { /* -Dname?? */ error("malformed option -D%s", text); break; } - macro_def(str2idf(name), mactext, -1, strlen(mactext), - NOFLAG); + macro_def(str2idf(name), mactext, -1, maclen, NOFLAG); #else NOPP warning("-D option ignored"); #endif NOPP