Added atol() that ignores overflow, so that unsigned long constants are dealt with...
authorCeriel Jacobs <c.j.h.jacobs@vu.nl>
Wed, 15 Jun 2011 09:13:48 +0000 (11:13 +0200)
committerNick Downing <nick@ndcode.org>
Wed, 17 Apr 2019 14:15:20 +0000 (00:15 +1000)
util/ass/assci.c

index 52a6484..d3d0b96 100644 (file)
@@ -849,8 +849,28 @@ extxcon(header) {
        return ;
 }
 
+/* Added atol() that ignores overflow. --Ceriel */
+long atol(s)
+    register char *s;
+{
+    register long total = 0;
+    register unsigned digit;
+    int minus = 0;
+
+    while (*s == ' ' || *s == '\t') s++;
+    if (*s == '+') s++;
+    else if (*s == '-') {
+        s++;
+        minus = 1;
+    }
+    while ((digit = *s++ - '0') < 10) {
+        total *= 10;
+        total += digit;
+    }
+    return(minus ? -total : total);
+}
+
 extvcon(header) {
-       extern long atol() ;
        /*
         * generate data for a constant initialized by a string.
         */