Remove RCS keywords, since they no longer work after git migration.
[mmh] / sbr / m_atoi.c
1
2 /*
3  * m_atoi.c -- Parse a string representation of a message number, and
4  *          -- return the numeric value of the message.  If the string
5  *          -- contains any non-digit characters, then return 0.
6  *
7  * This code is Copyright (c) 2002, by the authors of nmh.  See the
8  * COPYRIGHT file in the root directory of the nmh distribution for
9  * complete copyright information.
10  */
11
12 #include <h/mh.h>
13
14
15 int
16 m_atoi (char *str)
17 {
18     int i;
19     unsigned char *cp;
20
21     for (i = 0, cp = str; *cp; cp++) {
22 #ifdef LOCALE
23         if (!isdigit(*cp))
24 #else
25         if (*cp < '0' || *cp > '9')
26 #endif
27             return 0;
28
29         i *= 10;
30         i += (*cp - '0');
31     }
32
33     return i;
34 }