summary refs log tree commit diff
path: root/src/scan_ulong.c
blob: af19701d5f02c0f1ecacfcaee3ecac7db4837dfe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* Public domain. */

#include "scan.h"

unsigned int scan_ulong(register const 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;
}