aboutsummaryrefslogtreecommitdiffstats
path: root/sample/skipatou.c
diff options
context:
space:
mode:
authorhpa <hpa>2003-12-10 20:44:57 +0000
committerhpa <hpa>2003-12-10 20:44:57 +0000
commit36166b159309632a2f5485f5312952e2c97bcc63 (patch)
treece87f82ec36999c895c7bd654909b5ef9873b05e /sample/skipatou.c
parent614094b18a80ba39557beda64c7b732779d0b5fb (diff)
downloadsyslinux-36166b159309632a2f5485f5312952e2c97bcc63.tar.gz
syslinux-36166b159309632a2f5485f5312952e2c97bcc63.tar.xz
syslinux-36166b159309632a2f5485f5312952e2c97bcc63.zip
Split atou() and skip_atou() into separate modules
Diffstat (limited to 'sample/skipatou.c')
-rw-r--r--sample/skipatou.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sample/skipatou.c b/sample/skipatou.c
new file mode 100644
index 00000000..98881539
--- /dev/null
+++ b/sample/skipatou.c
@@ -0,0 +1,14 @@
+static inline int
+isdigit(int ch)
+{
+ return (ch >= '0') && (ch <= '9');
+}
+
+unsigned int skip_atou(const char **s)
+{
+ int i=0;
+
+ while (isdigit(**s))
+ i = i*10 + *((*s)++) - '0';
+ return i;
+}