http://www.berklix.org/src/bsd/fixes/FreeBSD/src/gen/contrib/nvi/common/exf.c+main.c.wysiwyg.REL=ALL.diff

*** old/src/contrib/nvi/common/exf.c	Tue Jan 21 17:34:15 1997
--- new/src/contrib/nvi/common/exf.c	Sat Mar 29 18:50:45 1997
***************
*** 735,740 ****
--- 735,741 ----
  	char *name;
  	int flags;
  {
+ 	extern char cmd_after_write[] ; /* jhs@ */
  	enum { NEWFILE, OLDFILE } mtype;
  	struct stat sb;
  	EXF *ep;
***************
*** 973,978 ****
--- 974,1005 ----
  	msgq(sp, M_INFO, s);
  	if (nf)
  		FREE_SPACE(sp, p, 0);
+ 
+ 	/* jhs@ wysiwyg start */
+         if ( cmd_after_write[0] != '\0') {
+                  /*
+                   * Run the -C command (typically a `make' that gets `groff'
+                   * to read our `vi' file, updates a postscript output file,
+                   * then request a reopen in ghostview window with
+                   *      kill -SIGUSR1 ghostview_pid
+                   * Thus vi + ghostview can now co-operte automatically,
+                   * without considerable repetitive mouse clicking.
+                   */
+                  if (system(cmd_after_write))
+                          /*
+                           * Now leave user to manually flush screen
+                           * with ^L or ^R after he's read message
+                           */
+                          msgq(sp, M_INFO,
+                                  "-C command Failed: %s",cmd_after_write);
+                  else    /*
+                           * Remove any output from a succesful -C command
+                           * (such as `make` or whatever), from the screen.
+                           */
+                          v_redraw(sp,ep,"redraw after -C command");
+                  }
+ 	/* jhs@ wysiwyg end */
+ 
  	return (0);
  }
  
*** old/src/contrib/nvi/common/main.c	Tue Jan 21 17:34:16 1997
--- new/src/contrib/nvi/common/main.c	Sat Mar 29 18:57:43 1997
***************
*** 43,48 ****
--- 43,52 ----
  static void	 v_estr __P((char *, int, char *));
  static int	 v_obsolete __P((char *, char *[]));
  
+ char cmd_after_write[_POSIX_ARG_MAX] = "\0" ; /* jhs@ wysiwyg */
+       /* _POSIX_ARG_MAX is not right I should use some other MAX */
+ 
+ 
  /*
   * editor --
   *	Main editor routine.

Add parameter C
*** old/src/contrib/nvi/common/main.c	Sun Jun  8 17:20:44 1997
--- new/src/contrib/nvi/common/main.c	Sun Jun  8 17:22:40 1997
***************
*** 165,170 ****
--- 165,173 ----
  		case 'e':		/* Ex mode. */
  			LF_CLR(SC_VI);
  			LF_SET(SC_EX);
+ 			break;
+ 		case 'C':     /* jhs@ wysiwyg */
+ 			strcpy(cmd_after_write,optarg);
  			break;
  		case 'F':		/* No snapshot. */
  			F_CLR(gp, G_SNAPSHOT);
