diff sbr/m_atoi.c @ 0:bce86c4163a3

Initial revision
author kono
date Mon, 18 Apr 2005 23:46:02 +0900
parents
children 441a2190cfae
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sbr/m_atoi.c	Mon Apr 18 23:46:02 2005 +0900
@@ -0,0 +1,30 @@
+/* m_atoi.c - parse a string representation of a message number */
+#ifndef	lint
+static char ident[] = "@(#)$Id$";
+#endif /* lint */
+
+#include "../h/mh.h"
+
+
+m_atoi (str)
+register char *str;
+{
+    register int    i;
+    register char  *cp;
+
+    i = 0;
+    cp = str;
+
+    while (*cp) {
+#ifdef LOCALE
+	if (!isdigit(*cp))
+#else
+	if (*cp < '0' || *cp > '9')
+#endif
+	    return 0;
+	i *= 10;
+	i += *cp++ - '0';
+    }
+
+    return i;
+}