summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/sample/atou.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/syslinux-4.02/sample/atou.c')
-rw-r--r--contrib/syslinux-4.02/sample/atou.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/syslinux-4.02/sample/atou.c b/contrib/syslinux-4.02/sample/atou.c
new file mode 100644
index 0000000..73b0bb7
--- /dev/null
+++ b/contrib/syslinux-4.02/sample/atou.c
@@ -0,0 +1,12 @@
+static inline int isdigit(int ch)
+{
+ return (ch >= '0') && (ch <= '9');
+}
+
+unsigned int atou(const char *s)
+{
+ unsigned int i = 0;
+ while (isdigit(*s))
+ i = i * 10 + (*s++ - '0');
+ return i;
+}