1: # include   <stdio.h>
   2: # include   <ingres.h>
   3: # include   <aux.h>
   4: # include   <sccs.h>
   5: 
   6: SCCSID(@(#)error.c	8.1	12/31/84)
   7: 
   8: # define    ERRDELIM    '~'
   9: 
  10: /*
  11: **  PROCESS ERROR MESSAGE (Standalone override)
  12: **
  13: **	This routine replaces the "error" routine for use in
  14: **	standalone routines such as creatdb and printr.  Its usage
  15: **	is identical to that of normal "error".
  16: **
  17: **	This routine is assumed to be called by process five; hence,
  18: **	all error messages it produces have a 5000 offset.
  19: **
  20: */
  21: 
  22: error(number, argvect)
  23: int number;
  24: char    *argvect;
  25: {
  26:     FILE        *iop;
  27:     char        **pv;
  28:     int     i;
  29:     register char   *p;
  30:     register int    err;
  31:     char        buf[10];
  32:     register char   c;
  33:     char        *errfilen();
  34: 
  35:     pv = &argvect;
  36:     err = number;
  37:     if ((iop = fopen(errfilen(5), "r")) == NULL)
  38:         syserr("error: open");
  39: 
  40:     /* read in the code and check for correct */
  41:     for (;;)
  42:     {
  43:         p = buf;
  44:         while ((c = getc(iop)) != '\t')
  45:         {
  46:             if (c <= 0)
  47:             {
  48:                 /* no code exists, print the first parm */
  49:                 printf("%d: %s\n\n", err, pv[0]);
  50:                 fclose(iop);
  51:                 return (err);
  52:             }
  53:             *p++ = c;
  54:         }
  55:         *p = 0;
  56:         i = atoi(buf);
  57:         if (i != err)
  58:         {
  59:             while ((c = getc(iop)) != ERRDELIM)
  60:                 if (c <= 0)
  61:                     syserr("proc_error: format err %d", err);
  62:             getc(iop);  /* throw out the newline */
  63:             continue;
  64:         }
  65: 
  66:         /* got the correct line, print it doing parameter substitution */
  67:         printf("%d: ", err);
  68:         c = '\n';
  69:         for (;;)
  70:         {
  71:             c = getc(iop);
  72:             if (c == EOF || c == ERRDELIM)
  73:             {
  74:                 printf("\n");
  75:                 fclose(iop);
  76:                 return (err);
  77:             }
  78:             if (c == '%')
  79:             {
  80:                 c = getc(iop);
  81:                 for (p = pv[c - '0']; c = *p; p++)
  82:                 {
  83:                     putchar(c);
  84:                 }
  85:                 continue;
  86:             }
  87:             putchar(c);
  88:         }
  89:     }
  90: }
  91: 
  92: nferror(number, arg1, arg2, arg3, arg4, arg5, arg6)
  93: int number;
  94: {
  95:     error(number, arg1, arg2, arg3, arg4, arg5, arg6);
  96: }

Defined functions

error defined in line 6; used 1 times
  • in line 95
nferror defined in line 92; never used

Defined macros

ERRDELIM defined in line 8; used 2 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1019
Valid CSS Valid XHTML 1.0 Strict