X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fm_atoi.c;h=0dcbffe4517bd1a797c847b963341303b40fa24a;hp=dffc799be2c543b7b652b64f446bd996083e1f2f;hb=f78e7c6e6e616cc4ff2bee8a726365fafef2d8ce;hpb=13f84dd50ca5754391dbd3296a5c7425f9363600 diff --git a/sbr/m_atoi.c b/sbr/m_atoi.c index dffc799..0dcbffe 100644 --- a/sbr/m_atoi.c +++ b/sbr/m_atoi.c @@ -1,36 +1,30 @@ - /* - * m_atoi.c -- Parse a string representation of a message number, and - * -- return the numeric value of the message. If the string - * -- contains any non-digit characters, then return 0. - * - * $Id$ - * - * This code is Copyright (c) 2002, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ +** m_atoi.c -- Parse a string representation of a message number, and +** -- return the numeric value of the message. If the string +** -- contains any non-digit characters, then return 0. +** +** This code is Copyright (c) 2002, by the authors of nmh. See the +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ #include +#include int -m_atoi (char *str) +m_atoi(char *str) { - int i; - unsigned char *cp; + int i; + unsigned char *cp; - for (i = 0, cp = str; *cp; cp++) { -#ifdef LOCALE - if (!isdigit(*cp)) -#else - if (*cp < '0' || *cp > '9') -#endif - return 0; + for (i = 0, cp = str; *cp; cp++) { + if (!isdigit(*cp)) + return 0; - i *= 10; - i += (*cp - '0'); - } + i *= 10; + i += (*cp - '0'); + } - return i; + return i; }