Browse Source

Added atol() that ignores overflow, so that unsigned long constants are dealt with properly

Ceriel Jacobs 13 years ago
parent
commit
b9c194b210
1 changed files with 21 additions and 1 deletions
  1. 21 1
      util/ass/assci.c

+ 21 - 1
util/ass/assci.c

@@ -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.
 	 */