tech-toolchain archive

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

make :ts documentation



Someone complained to me recently, that make(1) says:

     :tsc
          Words in the variable are normally separated by a space on expan-
          sion.  This modifier sets the separator to the character c.  If c is
          omitted, then no separator is used.  The common escapes (including
          octal numeric codes), work as expected.

which implied to him that :ts\124 should treated as octal
ie 'T' rather than decimal '|'.

Tweak the man page to indicate a leading 0 is needed
for octal, or enforce 3 octal chars as octal even without
leading 0?
Eg.

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	27 Feb 2016 02:04:23 -0000
@@ -3018,9 +3018,15 @@ ApplyModifiers(char *nstr, const char *t
 			    default:
 				if (isdigit((unsigned char)tstr[3])) {
 				    char *ep;
-
+				    int base = 0;
+				    
+				    /* check if we want to force octal */
+				    if (tstr[3] != '0' &&
+					strspn(&tstr[3], "01234567") == 3 &&
+					(tstr[6] == ':' || tstr[6] == endc))
+					base = 8;
 				    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