1: /*	@(#)ato.c	2.2	SCCS id keyword	*/
   2: /* Copyright (c) 1979 Regents of the University of California */
   3: #
   4: /*
   5:  * pi - Pascal interpreter code translator
   6:  *
   7:  * Charles Haley, Bill Joy UCB
   8:  * Version 1.2 November 1978
   9:  */
  10: 
  11: #include "whoami"
  12: #include "0.h"
  13: 
  14: long
  15: a8tol(cp)
  16:     char *cp;
  17: {
  18:     int err;
  19:     long l;
  20:     register CHAR c;
  21: 
  22:     l = 0;
  23:     err = 0;
  24:     while ((c = *cp++) != '\0') {
  25:         if (c == '8' || c == '9')
  26:             if (err == 0) {
  27:                 error("8 or 9 in octal number");
  28:                 err++;
  29:             }
  30:         c -= '0';
  31:         if ((l & 0160000000000L) != 0)
  32:             if (err == 0) {
  33:                 error("Number too large for this implementation");
  34:                 err++;
  35:             }
  36:         l = (l << 3) | c;
  37:     }
  38:     return (l);
  39: }
  40: 
  41: /*
  42:  * Note that the version of atof
  43:  * used in this compiler does not
  44:  * (sadly) complain when floating
  45:  * point numbers are too large.
  46:  */

Defined functions

Last modified: 1981-07-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1599
Valid CSS Valid XHTML 1.0 Strict