1/*	$NetBSD$	*/
2
3/*++
4/* NAME
5/*	alldig 3
6/* SUMMARY
7/*	predicate if string is all numerical
8/* SYNOPSIS
9/*	#include <stringops.h>
10/*
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/*--*/
28
29/* System library. */
30
31#include <sys_defs.h>
32#include <ctype.h>
33
34/* Utility library. */
35
36#include <stringops.h>
37
38/* alldig - return true if string is all digits */
39
40int     alldig(const char *string)
41{
42    const char *cp;
43
44    if (*string == 0)
45	return (0);
46    for (cp = string; *cp != 0; cp++)
47	if (!ISDIGIT(*cp))
48	    return (0);
49    return (1);
50}
51