~ubuntu-branches/ubuntu/dapper/postfix/dapper-security

« back to all changes in this revision

Viewing changes to src/util/alldig.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-02-27 09:33:07 UTC
  • Revision ID: james.westby@ubuntu.com-20050227093307-cn789t27ibnlh6tf
Tags: upstream-2.1.5
ImportĀ upstreamĀ versionĀ 2.1.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
}