summaryrefslogtreecommitdiff
path: root/scan_ulong.c
diff options
context:
space:
mode:
Diffstat (limited to 'scan_ulong.c')
-rw-r--r--scan_ulong.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/scan_ulong.c b/scan_ulong.c
new file mode 100644
index 0000000..af19701
--- /dev/null
+++ b/scan_ulong.c
@@ -0,0 +1,16 @@
1/* Public domain. */
2
3#include "scan.h"
4
5unsigned int scan_ulong(register const char *s,register unsigned long *u)
6{
7 register unsigned int pos = 0;
8 register unsigned long result = 0;
9 register unsigned long c;
10 while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10) {
11 result = result * 10 + c;
12 ++pos;
13 }
14 *u = result;
15 return pos;
16}