1: /* m_atoi.c - parse a string representation of a message number */ 2: 3: #include "../h/mh.h" 4: 5: 6: m_atoi (str) 7: register char *str; 8: { 9: register int i; 10: register char *cp; 11: 12: i = 0; 13: cp = str; 14: while (*cp) { 15: if (*cp < '0' || *cp > '9') 16: return 0; 17: i *= 10; 18: i += *cp++ - '0'; 19: } 20: 21: return i; 22: }