atoi.c 337 B

123456789101112131415161718
  1. /*
  2. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. /* $Header$ */
  6. #include <stdlib.h>
  7. #include <errno.h>
  8. int
  9. atoi(const char *nptr)
  10. {
  11. int i, e = errno;
  12. i = (int)strtol(nptr, (char **)NULL, 10);
  13. errno = e;
  14. return i;
  15. }