1 /* Extracted from sys/arch/i386/stand/lib/bootmenu.c */ 2 int atoi(const char *); 3 4 #define isnum(c) ((c) >= '0' && (c) <= '9') 5 6 int 7 atoi(const char *in) 8 { 9 const char *c; 10 int ret; 11 12 ret = 0; 13 c = in; 14 if (*c == '-') 15 c++; 16 for (; isnum(*c); c++) 17 ret = (ret * 10) + (*c - '0'); 18 19 return (*in == '-') ? -ret : ret; 20 } 21 22