*** 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. # Before-FreeBSD-2.2.2 *************** # Before-FreeBSD-2.2.2 *** 114,122 **** # Before-FreeBSD-2.2.2 F_SET(gp, G_SNAPSHOT); # Before-FreeBSD-2.2.2 # Before-FreeBSD-2.2.2 #ifdef DEBUG # Before-FreeBSD-2.2.2 ! while ((ch = getopt(argc, argv, "c:D:eFlRrSsT:t:vw:")) != EOF) # Before-FreeBSD-2.2.2 #else # Before-FreeBSD-2.2.2 ! while ((ch = getopt(argc, argv, "c:eFlRrSst:vw:")) != EOF) # Before-FreeBSD-2.2.2 #endif # Before-FreeBSD-2.2.2 switch (ch) { # Before-FreeBSD-2.2.2 case 'c': /* Run the command. */ # Before-FreeBSD-2.2.2 --- 118,127 ---- # Before-FreeBSD-2.2.2 F_SET(gp, G_SNAPSHOT); # Before-FreeBSD-2.2.2 # Before-FreeBSD-2.2.2 #ifdef DEBUG # Before-FreeBSD-2.2.2 ! while ((ch = getopt(argc, argv, "c:C:D:eFlRrSsT:t:vw:")) != EOF) # Before-FreeBSD-2.2.2 #else # Before-FreeBSD-2.2.2 ! while ((ch = getopt(argc, argv, "c:C:eFlRrSst:vw:")) != EOF) # Before-FreeBSD-2.2.2 ! /* C: jhs@ wysiwyg */ # Before-FreeBSD-2.2.2 #endif # Before-FreeBSD-2.2.2 switch (ch) { # Before-FreeBSD-2.2.2 case 'c': /* Run the command. */ *** 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 *************** *** 122,136 **** #ifdef GTAGS #ifdef DEBUG ! while ((ch = getopt(argc, argv, "c:D:eFGlRrSsT:t:vw:")) != EOF) #else ! while ((ch = getopt(argc, argv, "c:eFGlRrSst:vw:")) != EOF) #endif #else #ifdef DEBUG ! while ((ch = getopt(argc, argv, "c:D:eFlRrSsT:t:vw:")) != EOF) #else ! while ((ch = getopt(argc, argv, "c:eFlRrSst:vw:")) != EOF) #endif #endif switch (ch) { --- 122,136 ---- #ifdef GTAGS #ifdef DEBUG ! while ((ch = getopt(argc, argv, "c:C:D:eFGlRrSsT:t:vw:")) != EOF) #else ! while ((ch = getopt(argc, argv, "c:C:eFGlRrSst:vw:")) != EOF) #endif #else #ifdef DEBUG ! while ((ch = getopt(argc, argv, "c:C:D:eFlRrSsT:t:vw:")) != EOF) #else ! while ((ch = getopt(argc, argv, "c:C:eFlRrSst:vw:")) != EOF) #endif #endif switch (ch) { *************** *** 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);