"Fossies" - the Fresh Open Source Software Archive

Member "postfix-3.4.7/src/util/alldig.c" (23 Dec 2001, 928 Bytes) of package /linux/misc/postfix-3.4.7.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "alldig.c" see the Fossies "Dox" file reference documentation.

    1 /*++
    2 /* NAME
    3 /*  alldig 3
    4 /* SUMMARY
    5 /*  predicate if string is all numerical
    6 /* SYNOPSIS
    7 /*  #include <stringops.h>
    8 /*
    9 /*  int alldig(string)
   10 /*  const char *string;
   11 /* DESCRIPTION
   12 /*  alldig() determines if its argument is an all-numerical string.
   13 /* SEE ALSO
   14 /*  An alldig() routine appears in Brian W. Kernighan, P.J. Plauger:
   15 /*  "Software Tools", Addison-Wesley 1976.
   16 /* LICENSE
   17 /* .ad
   18 /* .fi
   19 /*  The Secure Mailer license must be distributed with this software.
   20 /* AUTHOR(S)
   21 /*  Wietse Venema
   22 /*  IBM T.J. Watson Research
   23 /*  P.O. Box 704
   24 /*  Yorktown Heights, NY 10598, USA
   25 /*--*/
   26 
   27 /* System library. */
   28 
   29 #include <sys_defs.h>
   30 #include <ctype.h>
   31 
   32 /* Utility library. */
   33 
   34 #include <stringops.h>
   35 
   36 /* alldig - return true if string is all digits */
   37 
   38 int     alldig(const char *string)
   39 {
   40     const char *cp;
   41 
   42     if (*string == 0)
   43     return (0);
   44     for (cp = string; *cp != 0; cp++)
   45     if (!ISDIGIT(*cp))
   46         return (0);
   47     return (1);
   48 }