evaluate numerical arguments as C constants, i.e. 010 == 8, 0x10 == 16
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 19 Apr 1990 00:53:19 +0000 (16:53 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Thu, 19 Apr 1990 00:53:19 +0000 (16:53 -0800)
SCCS-vsn: usr.bin/printf/printf.c 5.8
SCCS-vsn: usr.bin/printf/printf.1 5.6

usr/src/usr.bin/printf/printf.1
usr/src/usr.bin/printf/printf.c

index c26ac46..6b13161 100644 (file)
@@ -13,7 +13,7 @@
 .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
 .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 .\"
-.\"    @(#)printf.1    5.5 (Berkeley) %G%
+.\"    @(#)printf.1    5.6 (Berkeley) %G%
 .\"
 .TH PRINTF 1 "
 .AT 1
 .\"
 .TH PRINTF 1 "
 .AT 1
@@ -43,12 +43,12 @@ either
 or
 .IR s ;
 otherwise it is evaluated as a C constant, with the following extensions:
 or
 .IR s ;
 otherwise it is evaluated as a C constant, with the following extensions:
-.in +0.5i
+.sp
+.RS
 A leading plus or minus sign is allowed.
 A leading plus or minus sign is allowed.
-.br
 If the leading character is a single or double quote, or not a digit,
 plus, or minus sign, the value is the ASCII code of the next character.
 If the leading character is a single or double quote, or not a digit,
 plus, or minus sign, the value is the ASCII code of the next character.
-.in -0.5i
+.RE
 .PP
 The format string is reused as often as necessary to satisfy the
 .IR arguments .
 .PP
 The format string is reused as often as necessary to satisfy the
 .IR arguments .
index 5fb8aa6..8035bca 100644 (file)
@@ -22,7 +22,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)printf.c   5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)printf.c   5.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -263,7 +263,7 @@ getlong()
        if (!*gargv)
                return((long)0);
        if (index(number, **gargv))
        if (!*gargv)
                return((long)0);
        if (index(number, **gargv))
-               return(atol(*gargv++));
+               return(strtol(*gargv++, (char **)NULL, 0));
        return((long)asciicode());
 }
 
        return((long)asciicode());
 }