# 2.11BSD#431 - /usr/ingres/source/gutil/atoi.c

##### Functions

    atoi              X

       1: /*
       2: **  ASCII CHARACTER STRING TO 16-BIT INTEGER CONVERSION
       3: **
       4: **	`a' is a pointer to the character string, `i' is a
       5: **	pointer to the word which is to contain the result.
       6: **
       7: **	The return value of the function is:
       8: **		zero:	succesful conversion; `i' contains the integer
       9: **		+1:	numeric overflow; `i' is unchanged
      10: **		-1:	syntax error; `i' is unchanged
      11: **
      12: **	A valid string is of the form:
      13: **		<space>* [+-] <space>* <digit>* <space>*
      14: */
      15:
      16: atoi(a1, i)
      17: char    *a1;
      18: int *i;
      19: {
      20:     int     sign;       /* flag to indicate the sign */
      21:     register int    x;      /* holds the integer being formed */
      22:     register char   c;
      23:     register char   *a;
      24:
      25:     a = a1;
      26:     sign = 0;
      27:     /* skip leading blanks */
      28:     while (*a == ' ')
      29:         a++;
      30:     /* check for sign */
      31:     switch (*a)
      32:     {
      33:
      34:       case '-':
      35:         sign = -1;
      36:
      37:       case '+':
      38:         while (*++a == ' ');
      39:     }
      40:
      41:     /* at this point everything had better be numeric */
      42:     x = 0;
      43:     while ((c = *a) <= '9' && c >= '0')
      44:     {
      45:         if (x > 3276 || (x == 3276 && c > '7'))
      46:             return (1);     /* overflow */
      47:         x = x * 10 + c - '0';
      48:         a++;
      49:     }
      50:
      51:     /* eaten all the numerics; better be all blanks */
      52:     while (c = *a++)
      53:         if(c != ' ')            /* syntax error */
      54:             return (-1);
      55:     *i = sign ? -x : x;
      56:     return (0);     /* successful termination */
      57: }

#### Defined functions

atoi defined in line 16; used 52 times

- in /usr/ingres/source/dbu/copy.c line 507, 630
- in /usr/ingres/source/dbu/create.c line 684
- in /usr/ingres/source/dbu/display.c line 110
- in /usr/ingres/source/dbu/help.c line 35, 83
- in /usr/ingres/source/dbu/ksort.c line 62
- in /usr/ingres/source/dbu/modify.c line 458, 475, 497
- in /usr/ingres/source/dbu/rmqm.c line 121, 291, 534
- in /usr/ingres/source/dbu/save.c line 70-74(2), 193
- in /usr/ingres/source/equel/main.c line 183
- in /usr/ingres/source/gutil/atof.c line 108
- in /usr/ingres/source/gutil/trace.c line 65
- in /usr/ingres/source/iutil/initproc.c line 135, 143-151(3), 165-172(4)
- in /usr/ingres/source/iutil/initucode.c line 289, 295, 434-438(2)
- in /usr/ingres/source/monitor/main.c line 307
- in /usr/ingres/source/ovqp/typecheck.c line 124
- in /usr/ingres/source/parser/p_util.c line 211
- in /usr/ingres/source/qrymod/fillprotup.c line 57, 124, 132
- in /usr/ingres/source/support/creatdb.c line 1148
- in /usr/ingres/source/support/error.c line 54
- in /usr/ingres/source/support/ingres.c line 547, 554, 584-587(2)
- in /usr/ingres/source/support/printr.c line 79, 90, 104-114(3), 151-153(2), 159-161(2)

Last modified: 1980-12-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 412 |