/* Scanlong takes string as argument and returns long integer from beginning * of string - will not scan through string looking for numbers. If invalid, * returns 32767 and puts '\0' in first char of string. (C) 1987 Russell * Wallace - this routine may be freely distributed and used for program * development. Use +L compile option with Aztec C. */ unsigned long scanlong (string) char *string; { register short i; register unsigned long number=0L; register unsigned long digit=1; while ((string[0]<'0' || string[0]>'9')&& string[0]) string++; for (i=0;string[i]>='0' && string[i]<='9';i++) ; if (i==0 || i>10) { string[0]='\0'; return (32767); } do { number+=(string[--i]-'0')*digit; digit*=10; } while (i); return (number); }