tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make :ts documentation



David Holland <dholland-tech%netbsd.org@localhost> wrote:
> Much as octal has become irrelevant over the years, making any one
> thing behave differently from everything else isn't a good idea.

So the patch below is probably better - assume octal explicitly hex.

Index: var.c
===================================================================
RCS file: /cvsroot/src/usr.bin/make/var.c,v
retrieving revision 1.205
diff -u -p -r1.205 var.c
--- var.c	20 Feb 2016 01:19:03 -0000	1.205
+++ var.c	3 Mar 2016 23:29:04 -0000
@@ -3018,9 +3018,13 @@ ApplyModifiers(char *nstr, const char *t
 			    default:
 				if (isdigit((unsigned char)tstr[3])) {
 				    char *ep;
+				    int base = 8; /* assume octal */
 
+				    if (tstr[3] == '0' &&
+					(tstr[4] == 'X' || tstr[4] == 'x'))
+					base = 16;
 				    parsestate.varSpace =
-					strtoul(&tstr[3], &ep, 0);
+					strtoul(&tstr[3], &ep, base);
 				    if (*ep != ':' && *ep != endc)
 					goto bad_modifier;
 				    cp = ep;


Home | Main Index | Thread Index | Old Index