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

Defined functions

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