home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / UUCPbb_2_1_src.lzh / UUCPBB21 / xatol.c < prev   
Text File  |  1994-09-25  |  431b  |  26 lines

  1. /* Copyright 1994 Brad Spencer */
  2.  
  3. /* Provided at no cost to Bob Billson to do with what he will */
  4.  
  5. /* A bit different atol, ya it only deals with positive numbers */
  6.  
  7. #include <stdio.h>
  8.  
  9. long xatol (s)
  10. char *s;
  11. {
  12.     long v = 0;
  13.  
  14.     if (s == NULL  ||  *s == '\0')
  15.          return (0);
  16.  
  17.     while (*s  &&  (*s >= '0') && (*s <= '9'))
  18.       {
  19.          v *= 10;
  20.          v += ((*s) - '0');
  21.          s++;
  22.       }
  23.     return (v);
  24. }
  25.  
  26.