Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / util / alldig.c
blob5eb05c7b9277f421e1f416604633668f37aa1563
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* alldig 3
6 /* SUMMARY
7 /* predicate if string is all numerical
8 /* SYNOPSIS
9 /* #include <stringops.h>
11 /* int alldig(string)
12 /* const char *string;
13 /* DESCRIPTION
14 /* alldig() determines if its argument is an all-numerical string.
15 /* SEE ALSO
16 /* An alldig() routine appears in Brian W. Kernighan, P.J. Plauger:
17 /* "Software Tools", Addison-Wesley 1976.
18 /* LICENSE
19 /* .ad
20 /* .fi
21 /* The Secure Mailer license must be distributed with this software.
22 /* AUTHOR(S)
23 /* Wietse Venema
24 /* IBM T.J. Watson Research
25 /* P.O. Box 704
26 /* Yorktown Heights, NY 10598, USA
27 /*--*/
29 /* System library. */
31 #include <sys_defs.h>
32 #include <ctype.h>
34 /* Utility library. */
36 #include <stringops.h>
38 /* alldig - return true if string is all digits */
40 int alldig(const char *string)
42 const char *cp;
44 if (*string == 0)
45 return (0);
46 for (cp = string; *cp != 0; cp++)
47 if (!ISDIGIT(*cp))
48 return (0);
49 return (1);