]> diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/sbr/m_atoi.c
Always check that mktemp()/mktemp2() succeeds before trying to
[nmh] / docs / historical / mh-6.8.5 / sbr / m_atoi.c
1 /* m_atoi.c - parse a string representation of a message number */
2 #ifndef lint
3 static char ident[] = "@(#)$Id: m_atoi.c,v 1.2 1992/10/26 22:52:05 jromine Exp $";
4 #endif /* lint */
5
6 #include "../h/mh.h"
7
8
9 m_atoi (str)
10 register char *str;
11 {
12 register int i;
13 register char *cp;
14
15 i = 0;
16 cp = str;
17 #ifdef LOCALE
18 while (isdigit(*cp)) {
19 i *= 10;
20 i += *cp++ - '0';
21 }
22 #else
23 while (*cp) {
24 if (*cp < '0' || *cp > '9')
25 return 0;
26 i *= 10;
27 i += *cp++ - '0';
28 }
29 #endif
30
31 return i;
32 }