summaryrefslogtreecommitdiff
path: root/scan_ulong.c
blob: 69bc3d4e6061c409c6ee73215f516863f06d2e81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "scan.h"

unsigned int scan_ulong(register char *s,register unsigned long *u)
{
  register unsigned int pos = 0;
  register unsigned long result = 0;
  register unsigned long c;
  while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10) {
    result = result * 10 + c;
    ++pos;
  }
  *u = result;
  return pos;
}