macro and text revision (-mdoc version 3)
[unix-history] / usr / src / lib / libc / stdlib / strtol.c
index 07997e7..c4cac14 100644 (file)
@@ -6,12 +6,14 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtol.c   5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)strtol.c   5.4 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <limits.h>
 #include <ctype.h>
 #include <errno.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <limits.h>
 #include <ctype.h>
 #include <errno.h>
+#include <stdlib.h>
+
 
 /*
  * Convert a string to a long integer.
 
 /*
  * Convert a string to a long integer.
@@ -21,10 +23,11 @@ static char sccsid[] = "@(#)strtol.c        5.2 (Berkeley) %G%";
  */
 long
 strtol(nptr, endptr, base)
  */
 long
 strtol(nptr, endptr, base)
-       char *nptr, **endptr;
+       const char *nptr;
+       char **endptr;
        register int base;
 {
        register int base;
 {
-       register char *s = nptr;
+       register const char *s = nptr;
        register unsigned long acc;
        register int c;
        register unsigned long cutoff;
        register unsigned long acc;
        register int c;
        register unsigned long cutoff;
@@ -95,6 +98,6 @@ strtol(nptr, endptr, base)
        } else if (neg)
                acc = -acc;
        if (endptr != 0)
        } else if (neg)
                acc = -acc;
        if (endptr != 0)
-               *endptr = any ? s - 1 : nptr;
+               *endptr = any ? s - 1 : (char *)nptr;
        return (acc);
 }
        return (acc);
 }