1: # include   <stdio.h>
   2: 
   3: # include   "../ingres.h"
   4: # include   "../aux.h"
   5: # include   "../unix.h"
   6: # include   "monitor.h"
   7: 
   8: /*
   9: **  CALL TEXT EDITOR
  10: **
  11: **	The UNIX text editor is called.  The actual call is to
  12: **	the macro {editor}.  If that fails, /bin/ed is called.
  13: **	This routine suppressed the autoclear function.
  14: **
  15: **	Uses trace flag 4
  16: */
  17: 
  18: edit()
  19: {
  20:     register int    i;
  21:     register char   *p;
  22:     register char   *editfile;
  23:     char        *getfilename();
  24:     char        *macro();
  25: 
  26:     editfile = getfilename();
  27:     if (*editfile == 0)
  28:         editfile = Qbname;
  29: 
  30:     Autoclear = 0;
  31:     fclose(Qryiop);
  32: 
  33:     /* FORK SENTRY PROCESS & INVOKE THE EDITOR */
  34:     if ((Xwaitpid = fork()) < 0)
  35:         syserr("edit: fork");
  36:     if (Xwaitpid == 0)
  37:     {
  38:         setuid(getuid());
  39: #		ifndef xB_UNIX
  40:         setgid(getgid());
  41: #		endif
  42:         for (i = 3; i < MAXFILES; i++)
  43:             close(i);
  44:         p = macro("{editor}");
  45:         if (p != 0)
  46:         {
  47:             execl(p, p, editfile, 0);
  48:             printf("Cannot call %s; using /bin/ed\n", p);
  49:         }
  50:         execl("/bin/ed", "ed", editfile, 0);
  51:         syserr("edit: exec");
  52:     }
  53: 
  54:     /* WAIT FOR SENTRY TO DIE */
  55:     if (Nodayfile >= 0)
  56:         printf(">>ed\n");
  57:     xwait();
  58: }

Defined functions

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