Annotation of 43BSD/ingres/source/support/error.c, revision 1.1.1.1

1.1       root        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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.