home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3296 / numeric.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-07  |  422 b   |  26 lines

  1. /* History:
  2. 5/1/91 DJB baseline public domain
  3. */
  4.  
  5. /*
  6.  
  7. int numeric(s) char *s; returns 1 if s is entirely composed of the
  8. digits 0 through 9, 0 otherwise.
  9.  
  10. */
  11.  
  12. #include "numeric.h"
  13.  
  14. int numeric(s)
  15. char *s;
  16. {
  17.  while (*s)
  18.   {
  19.    if ((*s != '0') && (*s != '1') && (*s != '2') && (*s != '3') && (*s != '4')
  20.     && (*s != '5') && (*s != '6') && (*s != '7') && (*s != '8') && (*s != '9'))
  21.      return 0;
  22.    ++s;
  23.   }
  24.  return 1;
  25. }
  26.