summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libcruft/scan_ulong.c
blob: dfbec5c556e31c54adde792703bf39c70ad3ee46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <ctype.h>
#include <sys/types.h>
#include "parselib.h"

size_t scan_ulong(const char* s,unsigned long* l) {
  size_t n;
  unsigned long x;
  unsigned int digit;
  for (x=n=0; (digit=(s[n]-'0'))<10u; ++n)
    x=x*10+digit;
  *l=x;
  return n;
}