1: # include   <stdio.h>
   2: 
   3: # include   "../ingres.h"
   4: # include   "../aux.h"
   5: # include   "monitor.h"
   6: 
   7: /*
   8: **  WRITE OUT QUERY BUFFER TO UNIX FILE
   9: **
  10: **	The logical buffer is written to a UNIX file, the name of which
  11: **	must follow the \w command.
  12: **
  13: **	Uses trace flag 18
  14: */
  15: 
  16: writeout()
  17: {
  18:     register int    i;
  19:     register char   *file;
  20:     register int    source;
  21:     int     dest;
  22:     char        buf[512];
  23:     char        *getfilename();
  24: 
  25:     file = getfilename();
  26:     if (file[0] == 0 || file[0] == '-')
  27:     {
  28:         printf("Bad file name \"%s\"\n", file);
  29:         return;
  30:     }
  31: 
  32:     if ((dest = creat(file, 0644)) < 0)
  33:     {
  34:         printf("Cannot create \"%s\"\n", file);
  35:         return;
  36:     }
  37: 
  38:     if (!Nautoclear)
  39:         Autoclear = 1;
  40: 
  41:     if ((source = open(Qbname, 0)) < 0)
  42:         syserr("writeout: open(%s)\n", Qbname);
  43: 
  44:     fflush(Qryiop);
  45: 
  46:     while ((i = read(source, buf, sizeof buf)) > 0)
  47:         write(dest, buf, i);
  48: 
  49:     close(source);
  50:     close(dest);
  51: }

Defined functions

writeout defined in line 16; used 1 times
Last modified: 1995-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1229
Valid CSS Valid XHTML 1.0 Strict