# 2.11BSD#431 - /usr/ingres/source/monitor/eval.c

##### Functions

    eval              X

       1: # include   <stdio.h>
       2:
       3: # include   "../ingres.h"
       4: # include   "../aux.h"
       5: # include   "monitor.h"
       6:
       7: /*
       8: **  DO MACRO EVALUATION OF QUERY BUFFER
       9: **
      10: **	The logical query buffer is read and passed through the macro
      11: **	processor.  The main purpose of this is to evaluate {define}'s.
      12: **	If the 'pr' flag is set, the result is printed on the terminal,
      13: **	and so becomes a post-evaluation version of print.
      14: **
      15: **	Uses trace flag 12
      16: */
      17:
      18: eval(pr)
      19: int pr;
      20: {
      21:     register FILE   *tfile;
      22:     register char   c;
      23:     extern int  fgetc();
      24:     char        tfilename[40];
      25:
      26:     Autoclear = 0;
      27:     clrline(1);
      28:
      29:     /* open temp file and reopen query buffer for reading */
      30:     if (!pr)
      31:     {
      32:         concat("/tmp/INGTQ", Fileset, tfilename);
      33:         if ((tfile = fopen(tfilename, "w")) == NULL)
      34:             syserr("eval: open(%s)", tfilename);
      35:     }
      36:     if (freopen(Qbname, "r", Qryiop) == NULL)
      37:         syserr("eval: freopen 1");
      38:
      39:     /* COPY FILE */
      40:     macinit(&fgetc, Qryiop, 1);
      41:     while ((c = macgetch()) > 0)
      42:     {
      43:         if (pr)
      44:             putchar(c);
      45:         else
      46:             if (putc(c, tfile) == EOF)
      47:                 syserr("eval: putc");
      48:     }
      49:
      50:     if (!pr)
      51:     {
      52:         /* link temp file back to query buffer */
      53:         fclose(tfile);
      54:         unlink(Qbname);
      55:         if (link(tfilename, Qbname))
      56:             syserr("eval: link");
      57:         unlink(tfilename);
      58:     }
      59:
      60:     /* reopen query buffer (now evaluated) */
      61:     if (freopen(Qbname, "a", Qryiop) == NULL)
      62:         syserr("eval: freopen 2");
      63:
      64:     cgprompt();
      65: }

#### Defined functions

eval defined in line 18; used 2 times

- in /usr/ingres/source/monitor/monitor.c line 114-118(2)

Last modified: 1995-02-04 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1111 |