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