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

Defined functions

writeout defined in line 6; used 1 times
Last modified: 1986-04-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 828
Valid CSS Valid XHTML 1.0 Strict