1: # include   <stdio.h>
   2: 
   3: # include   "../ingres.h"
   4: # include   "../aux.h"
   5: # include   "../access.h"
   6: # include   "../lock.h"
   7: 
   8: 
   9: extern int  Status;
  10: 
  11: main(argc, argv)
  12: int argc;
  13: char    *argv[];
  14: {
  15:     extern struct out_arg   Out_arg;
  16:     register char       **av;
  17:     register int        i;
  18:     register char       *p;
  19:     extern char     *Parmvect[];
  20:     extern char     *Flagvect[];
  21:     extern char     *Dbpath;
  22:     int         nc;
  23:     char            *newpv[MAXPARMS];
  24:     char            **nv, *qm;
  25:     char            *qmtest();
  26: 
  27: #	ifdef xSTR1
  28:     tTrace(&argc, argv, 'T');
  29: #	endif
  30: 
  31:     i = initucode(argc, argv, TRUE, NULL, M_SHARE);
  32: #	ifdef xSTR2
  33:     if (tTf(0, 1))
  34:         printf("initucode=%d, Dbpath='%s'\n", i, Dbpath);
  35: #	endif
  36:     switch (i)
  37:     {
  38:       case 0:
  39:       case 5:
  40:         break;
  41: 
  42:       case 1:
  43:       case 6:
  44:         printf("Database %s does not exist\n", Parmvect[0]);
  45:         exit(-1);
  46: 
  47:       case 2:
  48:         printf("You are not authorized to access this database\n");
  49:         exit(-1);
  50: 
  51:       case 3:
  52:         printf("You are not a valid INGRES user\n");
  53:         exit(-1);
  54: 
  55:       case 4:
  56:         printf("No database name specified\n");
  57:     usage:
  58:         printf("usage: helpr database [relname ...]\n");
  59:         exit(-1);
  60: 
  61:       default:
  62:         syserr("initucode %d", i);
  63:     }
  64: 
  65:     if (Flagvect[0] != NULL)
  66:     {
  67:         printf("No flags are allowed for this command\n");
  68:         goto usage;
  69:     }
  70: 
  71:     if (chdir(Dbpath) < 0)
  72:         syserr("cannot access data base %s", p);
  73: #	ifdef xTTR2
  74:     if (tTf(1, 0))
  75:         printf("entered database %s\n", Dbpath);
  76: #	endif
  77: 
  78:     /* initialize access methods (and Admin struct) for user_ovrd test */
  79:     acc_init();
  80: 
  81:     av = &Parmvect[1];  /* get first param after datbase name */
  82:     p = *av;
  83:     if (p == NULL)
  84:     {
  85:         /* special case of no relations specified */
  86:         nv = newpv;
  87:         *nv++ = "2";
  88:         *nv = (char *) -1;
  89:         help(1, newpv);
  90:     }
  91:     else
  92:     {
  93:         do
  94:         {
  95:             nc = 0;
  96:             nv = newpv;
  97: 
  98:             if ((qm = qmtest(p)) != NULL)
  99:             {
 100:                 /* either help view, integrity or protect */
 101:                 av++;
 102:                 while ((p = *av++) != NULL)
 103:                 {
 104:                     if ((i = (int) qmtest(p)) != NULL)
 105:                     {
 106:                         /* change of qmtest result */
 107:                         qm = (char *) i;
 108:                         continue;
 109:                     }
 110:                     *nv++ = qm;
 111:                     *nv++ = p;
 112:                     nc += 2;
 113:                 }
 114:                 *nv = (char *) -1;
 115:                 display(nc, newpv);
 116:             }
 117:             else
 118:             {
 119:                 /* help relname */
 120:                 while ((p = *av++) != NULL && qmtest(p) == NULL)
 121:                 {
 122:                     if (sequal("all", p))
 123:                     {
 124:                         *nv++ = "3";
 125:                         nc++;
 126:                     }
 127:                     else
 128:                     {
 129:                         *nv++ = "0";
 130:                         *nv++ = p;
 131:                         nc += 2;
 132:                     }
 133:                 }
 134:                 *nv = (char *) -1;
 135:                 help(nc, newpv);
 136:                 /* this backs av up one step, so
 137: 				 * that it points at the keywords (permit,
 138: 				 * integrity, view) or the NULL
 139: 				 */
 140:                 --av;
 141:             }
 142:         } while (p != NULL);
 143:     }
 144:     flush();
 145:     exit(0);
 146: }
 147: 
 148: 
 149: 
 150: char *qmtest(parm)
 151: char    *parm;
 152: {
 153:     register char   *p;
 154: 
 155:     p = parm;
 156:     if (sequal("view", p))
 157:         return ("4");
 158:     else if (sequal("permit", p))
 159:         return ("5");
 160:     else if (sequal("integrity", p))
 161:         return ("6");
 162:     else
 163:         return (NULL);
 164: }
 165: 
 166: 
 167: rubproc()
 168: {
 169:     exit(1);
 170: }

Defined functions

main defined in line 11; never used
qmtest defined in line 150; used 4 times
rubproc defined in line 167; never used
Last modified: 1995-02-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1208
Valid CSS Valid XHTML 1.0 Strict