projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
macro and text revision (-mdoc version 3)
[unix-history]
/
usr
/
src
/
lib
/
libc
/
stdlib
/
atoi.c
diff --git
a/usr/src/lib/libc/stdlib/atoi.c
b/usr/src/lib/libc/stdlib/atoi.c
index
0b0b2ac
..
42e3fea
100644
(file)
--- a/
usr/src/lib/libc/stdlib/atoi.c
+++ b/
usr/src/lib/libc/stdlib/atoi.c
@@
-1,28
+1,19
@@
-#ifndef lint
-static char sccsid[] = "@(#)atoi.c 5.1 (Berkeley) %G%";
-#endif not lint
+/*
+ * Copyright (c) 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ */
-atoi(p)
-register char *p;
-{
- register int n;
- register int f;
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)atoi.c 5.7 (Berkeley) %G%";
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdlib.h>
+#include <stddef.h>
- n = 0;
- f = 0;
- for(;;p++) {
- switch(*p) {
- case ' ':
- case '\t':
- continue;
- case '-':
- f++;
- case '+':
- p++;
- }
- break;
- }
- while(*p >= '0' && *p <= '9')
- n = n*10 + *p++ - '0';
- return(f? -n: n);
+atoi(str)
+ const char *str;
+{
+ return((int)strtol(str, (char **)NULL, 10));
}
}