1: # include   <ingres.h>
   2: # include   <symbol.h>
   3: # include   "IIglobals.h"
   4: # include   <sccs.h>
   5: 
   6: SCCSID(@(#)IIerror.c	8.1	12/31/84)
   7: 
   8: 
   9: /*
  10: **	IIerror -- std. equel error reporting routine.
  11: **
  12: **		IIerror is called either directly by a
  13: **		routine detecting an error or by
  14: **		IIrdpipe where INGRES returns an error.
  15: **
  16: **		In the case of an appropriate error, IIerrflag is set to
  17: **		prevent the reading of the ovqp data pipe. This happens
  18: **		on errors that happen during retrieves to C vars.
  19: **
  20: **		Errno is the error number: 1??? is an equel error
  21: **		others are Ingres errors.
  22: **
  23: **		Argc and argv are structured as in Unix main program calls.
  24: **
  25: **		The error is printed if the call (*IIprint_err)()
  26: **		returns > 0. Otherwise no error message is printed.
  27: **		The error message that is printed is the one corresponding
  28: **		to the number returned by (*IIprint_err)().
  29: */
  30: 
  31: extern  IIret_err();
  32: int (*IIprint_err)() =  IIret_err;
  33: 
  34: 
  35: IIerror(errno, argc, argv)
  36: int errno, argc;
  37: char    *argv [];
  38: {
  39:     register int        i;
  40: 
  41: #	ifdef xETR1
  42:     if (IIdebug > 1)
  43:         printf("ent IIerror : errno %d, argc %d\n", errno, argc);
  44: #	endif
  45: 
  46:     IIerrflag = errno;
  47:     if (!(errno = (*IIprint_err)(errno)))
  48:     {
  49: #		ifdef xETR2
  50:         if (IIdebug > 1)
  51:             printf("IIerror : IIprint_err returned 0\n");
  52: #		endif
  53:         /* if must restore printing turned off in IIw_left()
  54: 		 * or IIw_right(), then do so.
  55: 		 */
  56:         if (IIo_print)
  57:         {
  58:             IIprint_err = IIo_print;
  59:             IIo_print = 0;
  60:         }
  61:         return;
  62:     }
  63: 
  64:     if (errno > 2000)
  65:         printf("INGRES ERROR: ");
  66:     else
  67:         printf("EQUEL ERROR: ");
  68: 
  69:     if (!IIp_err(errno, argc, argv))
  70:     {
  71:         /* couldn't process error in IIp_err() */
  72:         printf(" %d with parameters:",errno);
  73:         for (i = 0; i < argc; )
  74:             printf(" %s", argv [i++]);
  75:         printf("\n");
  76:     }
  77:     if (IIproc_name)
  78:         printf("On file %s line %d.\n", IIproc_name, IIline_no);
  79: }
  80: 
  81: /*
  82: **  IIret_err -- returns its single argument for IIerror.
  83: **
  84: */
  85: 
  86: IIret_err(err)
  87: int err;
  88: {
  89:     return (err);
  90: }
  91: 
  92: /*
  93: **  IIno_err -- returns 0. Called from IIerror
  94: **		(through (*IIprint_err)())
  95: **		to supress error message printing.
  96: */
  97: 
  98: IIno_err(err)
  99: int err;
 100: {
 101:     return (0);
 102: }

Defined functions

IIno_err defined in line 98; used 1 times
IIret_err defined in line 86; used 3 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 789
Valid CSS Valid XHTML 1.0 Strict