aboutsummaryrefslogtreecommitdiff
path: root/scan_ulong.c
blob: d70b334c8ff9bd2b447ca295b5301528393d5aa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#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;
}