# 2.11BSD#431 - /usr/ingres/source/iutil/initproc.c

##### Functions

    initproc          X

##### Variables

    Database          X
    Equel             X
    Fileset           X
    Out_arg           X
    Pathname          X
    R_down            X
    R_front           X
    R_up              X
    Rublevel          X
    Standalone        X
    Usercode          X
    W_down            X
    W_err             X
    W_front           X
    W_up              X
    Xparams           X

##### Macros

    CLOSED            X

       1: # include   "../ingres.h"
       2: # include   "../aux.h"
       3: # include   "../unix.h"
       4:
       5: # define    CLOSED      077
       6:
       7: /*
       8: **  Initialize INGRES Process
       9: **
      10: **	All initialization for a process is performed, including
      11: **	initialization of trace info and global variables.  Typical
      12: **	call is
      13: **		initproc(procname, argv);
      14: **	with procname being a string (e.g., "PARSER"),
      15: **	argv is the parameter of main().
      16: **
      17: **	Calling this routine should be one of the first things done
      18: **	in  main().
      19: **
      20: **	Information passed in argv is as follows:
      21: **	argv[0] - line from process table
      22: **	argv[1] - pipe vector
      23: **		argv[1][0] - R_up
      24: **		argv[1][1] - W_up
      25: **		argv[1][2] - R_down
      26: **		argv[1][3] - W_down
      27: **		argv[1][4] - R_front
      28: **		argv[1][5] - W_front
      29: **	argv[2] - Fileset - unique character string for temp file names.
      30: **	argv[3] - Usercode - two character user identifier
      31: **	argv[4] - Database - database name
      32: **	argv[5->n] - Xparams - additional parameters,
      33: **		different for each process.  See .../files/proctab
      34: **		for what each process actually gets.
      35: **
      36: **	The pipe descriptors are passed with the 0100 bit set, so that
      37: **	they will show up in a readable fashion on a "ps".
      38: **
      39: **	A flag "Equel" is set if running an EQUEL program.  The flag
      40: **	is set to 1 if the EQUEL program is a 6.0 or 6.0 EQUEL program,
      41: **	and to 2 if it is a 6.2 EQUEL program.
      42: **
      43: **	User flags "[+-]x" are processed.  Note that the syntax of some of
      44: **	these are assumed to be correct.  They should be checked in
      45: **	ingres.c.
      46: **
      47: **	Signal 2 is caught and processed by 'rubcatch', which will
      48: **	eventually call 'rubproc', a user supplied routine which cleans
      49: **	up the relevant process.
      50: **
      51: **	History:
      52: **		6/29/79 (eric) (mod 6) -- Standalone variable added.
      53: */
      54:
      55: char        *Fileset;   /* unique string to append to temp file names */
      56: char        *Usercode;  /* code to append to relation names */
      57: char        *Database;  /* database name */
      58: char        **Xparams;  /* other parameters */
      59: char        *Pathname;  /* pathname of INGRES subtree */
      60: int     R_up;       /* pipe descriptor: read from above */
      61: int     W_up;       /* pipe descriptor: write to above */
      62: int     R_down;     /* pipe descriptor: read from below */
      63: int     W_down;     /* pipe descriptor: write to below */
      64: int     R_front;    /* pipe descriptor: read from front end */
      65: int     W_front;    /* pipe descriptor: write to front end */
      66: int     W_err;      /* pipe descriptor: write error message (usually W_up */
      67: int     Equel;      /* flag set if running an EQUEL program */
      68: int     Rublevel;   /* rubout level, set to -1 if turned off */
      69: struct out_arg  Out_arg;    /* output arguments */
      70: int     Standalone; /* not standalone */
      71:
      72: initproc(procname, argv)
      73: char    *procname;
      74: char    **argv;
      75: {
      76:     extern char *Proc_name; /* defined in syserr.c */
      77:     register char   *p;
      78:     register char   **q;
      79:     register int    fd;
      80:     extern      rubcatch(); /* defined in rub.c */
      81:     static int  reenter;
      82:
      83:     Standalone = FALSE;
      84:     Proc_name = procname;
      85:     reenter = 0;
      86:     setexit();
      87:     if (reenter++)
      88:         exit(-1);
      89:     if (signal(2, 1) == 0)
      90:         signal(2, &rubcatch);
      91:     else
      92:         Rublevel = -1;
      93:     p = argv[1];
      94:     R_up = fd = *p++ & 077;
      95:     if (fd == CLOSED)
      96:         R_up = -1;
      97:     W_up = fd = *p++ & 077;
      98:     if (fd == CLOSED)
      99:         W_up = -1;
     100:     W_err = W_up;
     101:     R_down = fd = *p++ & 077;
     102:     if (fd == CLOSED)
     103:         R_down = -1;
     104:     W_down = fd = *p++ & 077;
     105:     if (fd == CLOSED)
     106:         W_down = -1;
     107:     R_front = fd = *p++ & 077;
     108:     if (fd == CLOSED)
     109:         R_front = -1;
     110:     W_front = fd = *p++ & 077;
     111:     if (fd == CLOSED)
     112:         W_front = -1;
     113:
     114:     q = &argv[2];
     115:     Fileset = *q++;
     116:     Usercode = *q++;
     117:     Database = *q++;
     118:     Pathname = *q++;
     119:     Xparams = q;
     120:
     121:     /* process flags */
     122:     for (; (p = *q) != -1 && p != NULL; q++)
     123:     {
     124:         if (p[0] != '-')
     125:             continue;
     126:         switch (p[1])
     127:         {
     128:           case '&': /* equel program */
     129:             Equel = 1;
     130:             if (p[6] != '\0')
     131:                 Equel = 2;
     132:             break;
     133:
     134:           case 'c': /* c0 sizes */
     135:             atoi(&p[2], &Out_arg.c0width);
     136:             break;
     137:
     138:           case 'i': /* iNsizes */
     139:             switch (p[2])
     140:             {
     141:
     142:               case '1':
     143:                 atoi(&p[3], &Out_arg.i1width);
     144:                 break;
     145:
     146:               case '2':
     147:                 atoi(&p[3], &Out_arg.i2width);
     148:                 break;
     149:
     150:               case '4':
     151:                 atoi(&p[3], &Out_arg.i4width);
     152:                 break;
     153:
     154:             }
     155:             break;
     156:
     157:           case 'f': /* fN sizes */
     158:             p = &p[3];
     159:             fd = *p++;
     160:             while (*p != '.')
     161:                 p++;
     162:             *p++ = 0;
     163:             if ((*q)[2] == '4')
     164:             {
     165:                 atoi(&(*q)[4], &Out_arg.f4width);
     166:                 atoi(p, &Out_arg.f4prec);
     167:                 Out_arg.f4style = fd;
     168:             }
     169:             else
     170:             {
     171:                 atoi(&(*q)[4], &Out_arg.f8width);
     172:                 atoi(p, &Out_arg.f8prec);
     173:                 Out_arg.f8style = fd;
     174:             }
     175:             *--p = '.'; /* restore parm for dbu's */
     176:             break;
     177:
     178:           case 'v': /* vertical seperator */
     179:             Out_arg.coldelim = p[2];
     180:             break;
     181:
     182:         }
     183:     }
     184: }

#### Defined functions

initproc defined in line 72; used 6 times

- in /usr/ingres/source/dbu/main.c line 112
- in /usr/ingres/source/decomp/main.c line 23
- in /usr/ingres/source/monitor/main.c line 78
- in /usr/ingres/source/ovqp/main.c line 25
- in /usr/ingres/source/parser/main.c line 33
- in /usr/ingres/source/qrymod/main.c line 119

#### Defined variables

Database defined in line 57; used 2 times

- in line 117
- in /usr/ingres/source/monitor/main.c line 114

Equel defined in line 67; used 6 times

- in line 129-131(2)
- in /usr/ingres/source/ovqp/scan.c line 238
- in /usr/ingres/source/ovqp/startovqp.c line 21
- in /usr/ingres/source/ovqp/support.c line 25
- in /usr/ingres/source/qrymod/main.c line 173

Fileset defined in line 55; used 1 times

- in line 115

Out_arg defined in line 69; used 11 times

- in line 135, 143-151(3), 165-173(6), 179

Pathname defined in line 59; used 21 times

- in line 118
- in /usr/ingres/source/dbu/help.c line 132-136(2), 151
- in /usr/ingres/source/iutil/errfilen.c line 34
- in /usr/ingres/source/iutil/getnuser.c line 49
- in /usr/ingres/source/iutil/getuser.c line 42
- in /usr/ingres/source/iutil/initproc.c line 118
- in /usr/ingres/source/iutil/initucode.c line 285, 382, 687-692(2), 710
- in /usr/ingres/source/monitor/main.c line 113, 123
- in /usr/ingres/source/support/creatdb.c line 466
- in /usr/ingres/source/support/ingres.c line 338, 365, 856, 1459
- in /usr/ingres/source/support/sysmod.c line 130

R_down defined in line 62; used 4 times

- in line 101-103(2)
- in /usr/ingres/source/qrymod/issue.c line 84-85(2)

R_front defined in line 64; used 2 times

- in line 107-109(2)

R_up defined in line 60; used 22 times

- in line 94-96(2)
- in /usr/ingres/source/qrymod/d_integ.c line 70
- in /usr/ingres/source/qrymod/d_view.c line 80-85(2)
- in /usr/ingres/source/qrymod/define.c line 152
- in /usr/ingres/source/qrymod/fillprotup.c line 55, 64-74(3), 91, 123, 131, 139, 148, 157
- in /usr/ingres/source/qrymod/main.c line 160-161(2), 170, 189
- in /usr/ingres/source/qrymod/readtree.c line 231
- in /usr/ingres/source/qrymod/util.c line 264

Rublevel defined in line 68; used 1 times

- in line 92

Standalone defined in line 70; used 1 times

- in line 83

Usercode defined in line 56; used 1 times

- in line 116

W_down defined in line 63; used 5 times

- in line 104-106(2)
- in /usr/ingres/source/qrymod/issue.c line 75, 177
- in /usr/ingres/source/qrymod/main.c line 189

W_err defined in line 66; used 1 times

- in line 100

W_front defined in line 65; used 2 times

- in line 110-112(2)

W_up defined in line 61; used 7 times

- in line 97-100(3)
- in /usr/ingres/source/qrymod/main.c line 198-199(2)
- in /usr/ingres/source/qrymod/util.c line 287-288(2)

Xparams defined in line 58; used 1 times

- in line 119

#### Defined macros

CLOSED defined in line 5; used 6 times

- in line 95-111(6)

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