summaryrefslogtreecommitdiff
path: root/usr.bin/vi/common
diff options
context:
space:
mode:
authormichaels <michaels@cvs.openbsd.org>1996-08-16 17:58:49 +0000
committermichaels <michaels@cvs.openbsd.org>1996-08-16 17:58:49 +0000
commit418c0bbade1dcb322b7abdbed4064993de8086c2 (patch)
tree4bad4d39a1f432f68cae3d673074f4b724aba879 /usr.bin/vi/common
parent445816164da4c953591f89549fdd9bc8825aa8c8 (diff)
nvi 1.73
Diffstat (limited to 'usr.bin/vi/common')
-rw-r--r--usr.bin/vi/common/api.c47
-rw-r--r--usr.bin/vi/common/exf.c147
-rw-r--r--usr.bin/vi/common/exf.h17
-rw-r--r--usr.bin/vi/common/gs.h4
-rw-r--r--usr.bin/vi/common/main.c4
-rw-r--r--usr.bin/vi/common/mark.c4
-rw-r--r--usr.bin/vi/common/msg.c22
-rw-r--r--usr.bin/vi/common/options.c8
-rw-r--r--usr.bin/vi/common/options.h4
-rw-r--r--usr.bin/vi/common/options_f.c29
-rw-r--r--usr.bin/vi/common/screen.c6
-rw-r--r--usr.bin/vi/common/screen.h10
12 files changed, 209 insertions, 93 deletions
diff --git a/usr.bin/vi/common/api.c b/usr.bin/vi/common/api.c
index a4c5a2a73ed..9314fe6d047 100644
--- a/usr.bin/vi/common/api.c
+++ b/usr.bin/vi/common/api.c
@@ -12,7 +12,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)api.c 8.19 (Berkeley) 6/8/96";
+static const char sccsid[] = "@(#)api.c 8.22 (Berkeley) 8/10/96";
#endif /* not lint */
#include <sys/types.h>
@@ -199,6 +199,34 @@ api_setmark(sp, markname, mp)
}
/*
+ * api_nextmark --
+ * Return the first mark if next not set, otherwise return the
+ * subsequent mark.
+ *
+ * PUBLIC: int api_nextmark __P((SCR *, int, char *));
+ */
+int
+api_nextmark(sp, next, namep)
+ SCR *sp;
+ int next;
+ char *namep;
+{
+ LMARK *mp;
+
+ mp = sp->ep->marks.lh_first;
+ if (next)
+ for (; mp != NULL; mp = mp->q.le_next)
+ if (mp->name == *namep) {
+ mp = mp->q.le_next;
+ break;
+ }
+ if (mp == NULL)
+ return (1);
+ *namep = mp->name;
+ return (0);
+}
+
+/*
* api_getcursor --
* Get the cursor.
*
@@ -269,16 +297,18 @@ api_imessage(sp, text)
}
/*
- * api_iscreen
- * Create a new screen and return its id.
+ * api_edit
+ * Create a new screen and return its id
+ * or edit a new file in the current screen.
*
- * PUBLIC: int api_iscreen __P((SCR *, char *, int *));
+ * PUBLIC: int api_edit __P((SCR *, char *, SCR **, int));
*/
int
-api_iscreen(sp, file, idp)
+api_edit(sp, file, spp, newscreen)
SCR *sp;
char *file;
- int *idp;
+ SCR **spp;
+ int newscreen;
{
ARGS *ap[2], a;
EXCMD cmd;
@@ -288,10 +318,11 @@ api_iscreen(sp, file, idp)
ex_cadd(&cmd, &a, file, strlen(file));
} else
ex_cinit(&cmd, C_EDIT, 0, OOBLNO, OOBLNO, 0, NULL);
- cmd.flags |= E_NEWSCREEN; /* XXX */
+ if (newscreen)
+ cmd.flags |= E_NEWSCREEN; /* XXX */
if (cmd.cmd->fn(sp, &cmd))
return (1);
- *idp = sp->nextdisp->id;
+ *spp = sp->nextdisp;
return (0);
}
diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c
index 97b5e9ee4dc..c0b181bfe41 100644
--- a/usr.bin/vi/common/exf.c
+++ b/usr.bin/vi/common/exf.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)exf.c 10.42 (Berkeley) 6/19/96";
+static const char sccsid[] = "@(#)exf.c 10.46 (Berkeley) 8/11/96";
#endif /* not lint */
#include <sys/param.h>
@@ -41,6 +41,7 @@ static const char sccsid[] = "@(#)exf.c 10.42 (Berkeley) 6/19/96";
static int file_backup __P((SCR *, char *, char *));
static void file_cinit __P((SCR *));
static void file_comment __P((SCR *));
+static int file_spath __P((SCR *, FREF *, struct stat *, int *));
/*
* file_add --
@@ -133,7 +134,7 @@ file_init(sp, frp, rcv_name, flags)
RECNOINFO oinfo;
struct stat sb;
size_t psize;
- int fd, open_err, readonly;
+ int fd, exists, open_err, readonly;
char *oname, tname[MAXPATHLEN];
open_err = readonly = 0;
@@ -168,13 +169,20 @@ file_init(sp, frp, rcv_name, flags)
F_SET(ep, F_FIRSTMODIFY);
/*
+ * Scan the user's path to find the file that we're going to
+ * try and open.
+ */
+ if (file_spath(sp, frp, &sb, &exists))
+ return (1);
+
+ /*
* If no name or backing file, for whatever reason, create a backing
* temporary file, saving the temp file name so we can later unlink
* it. If the user never named this file, copy the temporary file name
* to the real name (we display that until the user renames it).
*/
oname = frp->name;
- if (LF_ISSET(FS_OPENERR) || oname == NULL || stat(oname, &sb)) {
+ if (LF_ISSET(FS_OPENERR) || oname == NULL || !exists) {
if (opts_empty(sp, O_DIRECTORY, 0))
goto err;
(void)snprintf(tname, sizeof(tname),
@@ -200,6 +208,8 @@ file_init(sp, frp, rcv_name, flags)
psize = 1024;
if (!LF_ISSET(FS_OPENERR))
F_SET(frp, FR_NEWFILE);
+
+ time(&ep->mtime);
} else {
/*
* XXX
@@ -214,8 +224,10 @@ file_init(sp, frp, rcv_name, flags)
psize = 1;
psize *= 1024;
+ F_SET(ep, F_DEVSET);
ep->mdev = sb.st_dev;
ep->minode = sb.st_ino;
+
ep->mtime = sb.st_mtime;
if (!S_ISREG(sb.st_mode))
@@ -395,9 +407,6 @@ file_init(sp, frp, rcv_name, flags)
/* Set the initial cursor position, queue initial command. */
file_cinit(sp);
- /* Change the name of the icon/window. */
- (void)sp->gp->scr_rename(sp);
-
/* Redraw the screen from scratch, schedule a welcome message. */
F_SET(sp, SC_SCR_REFORMAT | SC_STATUS);
@@ -428,6 +437,73 @@ oerr: if (F_ISSET(ep, F_RCV_ON))
}
/*
+ * file_spath --
+ * Scan the user's path to find the file that we're going to
+ * try and open.
+ */
+static int
+file_spath(sp, frp, sbp, existsp)
+ SCR *sp;
+ FREF *frp;
+ struct stat *sbp;
+ int *existsp;
+{
+ CHAR_T savech;
+ size_t len;
+ int found;
+ char *name, *p, *t, path[MAXPATHLEN];
+
+ /*
+ * If the name is NULL or an explicit reference (i.e., the first
+ * component is . or ..) ignore the O_PATH option.
+ */
+ name = frp->name;
+ if (name == NULL) {
+ *existsp = 0;
+ return (0);
+ }
+ if (name[0] == '/' || name[0] == '.' &&
+ (name[1] == '/' || name[1] == '.' && name[2] == '/')) {
+ *existsp = !stat(name, sbp);
+ return (0);
+ }
+
+ /* Try . */
+ if (!stat(name, sbp)) {
+ *existsp = 1;
+ return (0);
+ }
+
+ /* Try the O_PATH option values. */
+ for (found = 0, p = t = O_STR(sp, O_PATH);; ++p) {
+ if (*p == ':' || *p == '\0') {
+ if (t < p - 1) {
+ savech = *p;
+ *p = '\0';
+ len = snprintf(path,
+ sizeof(path), "%s/%s", t, name);
+ if (!stat(path, sbp))
+ found = 1;
+ *p = savech;
+ }
+ t = p + 1;
+ }
+ if (*p == '\0' || found)
+ break;
+ }
+
+ /* If we found it, build a new pathname and discard the old one. */
+ if (found) {
+ MALLOC_RET(sp, p, char *, len + 1);
+ memcpy(p, path, len + 1);
+ free(frp->name);
+ frp->name = p;
+ }
+ *existsp = found;
+ return (0);
+}
+
+/*
* file_cinit --
* Set up the initial cursor position.
*/
@@ -671,11 +747,13 @@ file_write(sp, fm, tm, name, flags)
char *p, *s, *t, buf[MAXPATHLEN + 64];
const char *msgstr;
+ ep = sp->ep;
+ frp = sp->frp;
+
/*
* Writing '%', or naming the current file explicitly, has the
* same semantics as writing without a name.
*/
- frp = sp->frp;
if (name == NULL || !strcmp(name, frp->name)) {
noname = 1;
name = frp->name;
@@ -728,20 +806,17 @@ file_write(sp, fm, tm, name, flags)
if (stat(name, &sb))
mtype = NEWFILE;
else {
- mtype = OLDFILE;
- if (!LF_ISSET(FS_FORCE | FS_APPEND)) {
- ep = sp->ep;
- if (noname && ep->mtime != 0 &&
- (sb.st_dev != sp->ep->mdev ||
- sb.st_ino != ep->minode ||
- sb.st_mtime != ep->mtime)) {
- msgq_str(sp, M_ERR, name,
- LF_ISSET(FS_POSSIBLE) ?
+ if (noname && !LF_ISSET(FS_FORCE | FS_APPEND) &&
+ (F_ISSET(ep, F_DEVSET) &&
+ (sb.st_dev != ep->mdev || sb.st_ino != ep->minode) ||
+ sb.st_mtime != ep->mtime)) {
+ msgq_str(sp, M_ERR, name, LF_ISSET(FS_POSSIBLE) ?
"250|%s: file modified more recently than this copy; use ! to override" :
"251|%s: file modified more recently than this copy");
- return (1);
- }
+ return (1);
}
+
+ mtype = OLDFILE;
}
/* Set flags to create, write, and either append or truncate. */
@@ -814,16 +889,16 @@ file_write(sp, fm, tm, name, flags)
* we re-init the time. That way the user can clean up the disk
* and rewrite without having to force it.
*/
- if (noname) {
- ep = sp->ep;
+ if (noname)
if (stat(name, &sb))
- ep->mtime = 0;
+ time(&ep->mtime);
else {
+ F_SET(ep, F_DEVSET);
ep->mdev = sb.st_dev;
ep->minode = sb.st_ino;
+
ep->mtime = sb.st_mtime;
}
- }
/*
* If the write failed, complain loudly. ex_writefp() has already
@@ -851,7 +926,7 @@ file_write(sp, fm, tm, name, flags)
* exiting.
*/
if (LF_ISSET(FS_ALL) && !LF_ISSET(FS_APPEND)) {
- F_CLR(sp->ep, F_MODIFIED);
+ F_CLR(ep, F_MODIFIED);
if (F_ISSET(frp, FR_TMPFILE))
if (noname)
F_SET(frp, FR_TMPEXIT);
@@ -1134,8 +1209,12 @@ file_m1(sp, force, flags)
SCR *sp;
int force, flags;
{
+ EXF *ep;
+
+ ep = sp->ep;
+
/* If no file loaded, return no modifications. */
- if (sp->ep == NULL)
+ if (ep == NULL)
return (0);
/*
@@ -1144,11 +1223,11 @@ file_m1(sp, force, flags)
* unless force is also set. Otherwise, we fail unless forced or
* there's another open screen on this file.
*/
- if (F_ISSET(sp->ep, F_MODIFIED))
+ if (F_ISSET(ep, F_MODIFIED))
if (O_ISSET(sp, O_AUTOWRITE)) {
if (!force && file_aw(sp, flags))
return (1);
- } else if (sp->ep->refcnt <= 1 && !force) {
+ } else if (ep->refcnt <= 1 && !force) {
msgq(sp, M_ERR, LF_ISSET(FS_POSSIBLE) ?
"262|File modified since last complete write; write or use ! to override" :
"263|File modified since last complete write; write or use :edit! to override");
@@ -1170,15 +1249,19 @@ file_m2(sp, force)
SCR *sp;
int force;
{
+ EXF *ep;
+
+ ep = sp->ep;
+
/* If no file loaded, return no modifications. */
- if (sp->ep == NULL)
+ if (ep == NULL)
return (0);
/*
* If the file has been modified, we'll want to fail, unless forced
* or there's another open screen on this file.
*/
- if (F_ISSET(sp->ep, F_MODIFIED) && sp->ep->refcnt <= 1 && !force) {
+ if (F_ISSET(ep, F_MODIFIED) && ep->refcnt <= 1 && !force) {
msgq(sp, M_ERR,
"264|File modified since last complete write; write or use ! to override");
return (1);
@@ -1198,8 +1281,12 @@ file_m3(sp, force)
SCR *sp;
int force;
{
+ EXF *ep;
+
+ ep = sp->ep;
+
/* If no file loaded, return no modifications. */
- if (sp->ep == NULL)
+ if (ep == NULL)
return (0);
/*
@@ -1209,7 +1296,7 @@ file_m3(sp, force)
* We permit writing to temporary files, so that user maps using file
* system names work with temporary files.
*/
- if (F_ISSET(sp->frp, FR_TMPEXIT) && sp->ep->refcnt <= 1 && !force) {
+ if (F_ISSET(sp->frp, FR_TMPEXIT) && ep->refcnt <= 1 && !force) {
msgq(sp, M_ERR,
"265|File is a temporary; exit will discard modifications");
return (1);
diff --git a/usr.bin/vi/common/exf.h b/usr.bin/vi/common/exf.h
index 8ea3edc2c94..cdfaa829448 100644
--- a/usr.bin/vi/common/exf.h
+++ b/usr.bin/vi/common/exf.h
@@ -6,7 +6,7 @@
*
* See the LICENSE file for redistribution information.
*
- * @(#)exf.h 10.6 (Berkeley) 3/6/96
+ * @(#)exf.h 10.7 (Berkeley) 7/9/96
*/
/* Undo direction. */
/*
@@ -52,13 +52,14 @@ struct _exf {
char *rcv_mpath; /* Recover mail file name. */
int rcv_fd; /* Locked mail file descriptor. */
-#define F_FIRSTMODIFY 0x001 /* File not yet modified. */
-#define F_MODIFIED 0x002 /* File is currently dirty. */
-#define F_MULTILOCK 0x004 /* Multiple processes running, lock. */
-#define F_NOLOG 0x008 /* Logging turned off. */
-#define F_RCV_NORM 0x010 /* Don't delete recovery files. */
-#define F_RCV_ON 0x020 /* Recovery is possible. */
-#define F_UNDO 0x040 /* No change since last undo. */
+#define F_DEVSET 0x001 /* mdev/minode fields initialized. */
+#define F_FIRSTMODIFY 0x002 /* File not yet modified. */
+#define F_MODIFIED 0x004 /* File is currently dirty. */
+#define F_MULTILOCK 0x008 /* Multiple processes running, lock. */
+#define F_NOLOG 0x010 /* Logging turned off. */
+#define F_RCV_NORM 0x020 /* Don't delete recovery files. */
+#define F_RCV_ON 0x040 /* Recovery is possible. */
+#define F_UNDO 0x080 /* No change since last undo. */
u_int8_t flags;
};
diff --git a/usr.bin/vi/common/gs.h b/usr.bin/vi/common/gs.h
index afb2721788c..542e2ef1e27 100644
--- a/usr.bin/vi/common/gs.h
+++ b/usr.bin/vi/common/gs.h
@@ -6,7 +6,7 @@
*
* See the LICENSE file for redistribution information.
*
- * @(#)gs.h 10.32 (Berkeley) 6/18/96
+ * @(#)gs.h 10.33 (Berkeley) 7/12/96
*/
#define TEMPORARY_FILE_STRING "/tmp" /* Default temporary file name. */
@@ -182,7 +182,7 @@ struct _gs {
/* Refresh the screen. */
int (*scr_refresh) __P((SCR *, int));
/* Rename the file. */
- int (*scr_rename) __P((SCR *));
+ int (*scr_rename) __P((SCR *, char *, int));
/* Set the screen type. */
int (*scr_screen) __P((SCR *, u_int32_t));
/* Suspend the editor. */
diff --git a/usr.bin/vi/common/main.c b/usr.bin/vi/common/main.c
index 61a0836bfaf..27dcb70a1c1 100644
--- a/usr.bin/vi/common/main.c
+++ b/usr.bin/vi/common/main.c
@@ -18,7 +18,7 @@ static const char copyright[] =
#endif /* not lint */
#ifndef lint
-static const char sccsid[] = "@(#)main.c 10.43 (Berkeley) 5/15/96";
+static const char sccsid[] = "@(#)main.c 10.44 (Berkeley) 7/13/96";
#endif /* not lint */
#include <sys/types.h>
@@ -417,7 +417,7 @@ editor(gp, argc, argv)
/* Switch into the right editor, regardless. */
F_CLR(sp, SC_EX | SC_VI);
- F_SET(sp, LF_ISSET(SC_EX | SC_VI));
+ F_SET(sp, LF_ISSET(SC_EX | SC_VI) | SC_STATUS_CNT);
/*
* Main edit loop. Vi handles split screens itself, we only return
diff --git a/usr.bin/vi/common/mark.c b/usr.bin/vi/common/mark.c
index 21bd68067b2..0ac1fc28bf9 100644
--- a/usr.bin/vi/common/mark.c
+++ b/usr.bin/vi/common/mark.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)mark.c 10.12 (Berkeley) 3/30/96";
+static const char sccsid[] = "@(#)mark.c 10.13 (Berkeley) 7/19/96";
#endif /* not lint */
#include <sys/types.h>
@@ -41,7 +41,7 @@ static LMARK *mark_find __P((SCR *, ARG_CHAR_T));
* if we've given the line to v_ntext.c:v_ntext() for editing. Historic vi
* would move to the first non-blank on the line when the mark location was
* past the end of the line. This can be complicated by deleting to a mark
- * that has disappeared using the ` command. Historic vi vi treated this as
+ * that has disappeared using the ` command. Historic vi treated this as
* a line-mode motion and deleted the line. This implementation complains to
* the user.
*
diff --git a/usr.bin/vi/common/msg.c b/usr.bin/vi/common/msg.c
index 9327b6d2b4d..e705b07d9f2 100644
--- a/usr.bin/vi/common/msg.c
+++ b/usr.bin/vi/common/msg.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)msg.c 10.39 (Berkeley) 6/20/96";
+static const char sccsid[] = "@(#)msg.c 10.42 (Berkeley) 8/11/96";
#endif /* not lint */
#include <sys/param.h>
@@ -517,21 +517,35 @@ msgq_status(sp, lno, flags)
u_int flags;
{
recno_t last;
- const char *t;
- char *bp, *np, *p, *s;
- int needsep;
size_t blen, len;
+ int cnt, needsep;
+ const char *t;
+ char **ap, *bp, *np, *p, *s;
+ /* Get sufficient memory. */
len = strlen(sp->frp->name);
GET_SPACE_GOTO(sp, bp, blen, len + 128);
p = bp;
+ /* Copy in the filename. */
memmove(p, sp->frp->name, len);
p += len;
np = p;
*p++ = ':';
*p++ = ' ';
+ /* Copy in the argument count. */
+ if (F_ISSET(sp, SC_STATUS_CNT) && sp->argv != NULL) {
+ for (cnt = 0, ap = sp->argv; *ap != NULL; ++ap, ++cnt);
+ (void)sprintf(p,
+ msg_cat(sp, "317|%d files to edit", NULL), cnt);
+ p += strlen(p);
+ *p++ = ':';
+ *p++ = ' ';
+
+ F_CLR(sp, SC_STATUS_CNT);
+ }
+
/*
* See nvi/exf.c:file_init() for a description of how and when the
* read-only bit is set.
diff --git a/usr.bin/vi/common/options.c b/usr.bin/vi/common/options.c
index 891e7333edb..9dea74ddff3 100644
--- a/usr.bin/vi/common/options.c
+++ b/usr.bin/vi/common/options.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)options.c 10.46 (Berkeley) 6/26/96";
+static const char sccsid[] = "@(#)options.c 10.48 (Berkeley) 8/10/96";
#endif /* not lint */
#include <sys/types.h>
@@ -135,6 +135,8 @@ OPTLIST const optlist[] = {
{"optimize", NULL, OPT_1BOOL, 0},
/* O_PARAGRAPHS 4BSD */
{"paragraphs", f_paragraph, OPT_STR, 0},
+/* O_PATH 4.4BSD */
+ {"path", NULL, OPT_STR, 0},
/* O_PRINT 4.4BSD */
{"print", f_print, OPT_STR, 0},
/* O_PROMPT 4BSD */
@@ -215,7 +217,7 @@ OPTLIST const optlist[] = {
/* O_WINDOW 4BSD */
{"window", f_window, OPT_NUM, 0},
/* O_WINDOWNAME 4BSD */
- {"windowname", f_windowname, OPT_0BOOL, 0},
+ {"windowname", NULL, OPT_0BOOL, 0},
/* O_WRAPLEN 4.4BSD */
{"wraplen", NULL, OPT_NUM, 0},
/* O_WRAPMARGIN 4BSD */
@@ -346,6 +348,8 @@ opts_init(sp, oargs)
OI(O_MSGCAT, b1);
OI(O_REPORT, "report=5");
OI(O_PARAGRAPHS, "paragraphs=IPLPPPQPP LIpplpipbp");
+ (void)snprintf(b1, sizeof(b1), "path=%s", "");
+ OI(O_PATH, b1);
(void)snprintf(b1, sizeof(b1), "recdir=%s", _PATH_PRESERVE);
OI(O_RECDIR, b1);
OI(O_SECTIONS, "sections=NHSHH HUnhsh");
diff --git a/usr.bin/vi/common/options.h b/usr.bin/vi/common/options.h
index d598d0dac7a..805df7904c4 100644
--- a/usr.bin/vi/common/options.h
+++ b/usr.bin/vi/common/options.h
@@ -6,7 +6,7 @@
*
* See the LICENSE file for redistribution information.
*
- * @(#)options.h 10.16 (Berkeley) 5/16/96
+ * @(#)options.h 10.17 (Berkeley) 7/2/96
*/
/*
@@ -83,7 +83,7 @@ struct _optlist {
#define OPT_ALWAYS 0x002 /* Always call the support function. */
#define OPT_NDISP 0x004 /* Never display the option. */
#define OPT_NOSAVE 0x008 /* Mkexrc command doesn't save. */
-#define OPT_NOSET 0x010 /* Option may not be unset. */
+#define OPT_NOSET 0x010 /* Option may not be set. */
#define OPT_NOUNSET 0x020 /* Option may not be unset. */
#define OPT_NOZERO 0x040 /* Option may not be set to 0. */
u_int8_t flags;
diff --git a/usr.bin/vi/common/options_f.c b/usr.bin/vi/common/options_f.c
index 039ed0dbf7a..ea3c61160cf 100644
--- a/usr.bin/vi/common/options_f.c
+++ b/usr.bin/vi/common/options_f.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)options_f.c 10.24 (Berkeley) 6/26/96";
+static const char sccsid[] = "@(#)options_f.c 10.25 (Berkeley) 7/12/96";
#endif /* not lint */
#include <sys/types.h>
@@ -365,30 +365,3 @@ f_window(sp, op, str, valp)
*valp = 1;
return (0);
}
-
-/*
- * PUBLIC: int f_windowname __P((SCR *, OPTION *, char *, u_long *));
- */
-int
-f_windowname(sp, op, str, valp)
- SCR *sp;
- OPTION *op;
- char *str;
- u_long *valp;
-{
- /*
- * XXX
- * The cl_rename routine depends on the O_WINDOWNAME value being
- * already set, because it's a destructive action, and it wants
- * to make sure we have permission. This doesn't apply to other
- * screen types where the naming won't be destructive, so we don't
- * want to move the check up out of the screen code.
- */
- if (*valp)
- O_CLR(sp, O_WINDOWNAME);
- else
- O_SET(sp, O_WINDOWNAME);
-
- (void)sp->gp->scr_rename(sp);
- return (0);
-}
diff --git a/usr.bin/vi/common/screen.c b/usr.bin/vi/common/screen.c
index 4255d8f50c1..dfc4e40473b 100644
--- a/usr.bin/vi/common/screen.c
+++ b/usr.bin/vi/common/screen.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)screen.c 10.13 (Berkeley) 5/10/96";
+static const char sccsid[] = "@(#)screen.c 10.14 (Berkeley) 7/19/96";
#endif /* not lint */
#include <sys/types.h>
@@ -151,6 +151,10 @@ screen_end(sp)
F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
rval = 0;
+#ifdef HAVE_PERL_INTERP
+ if (perl_screen_end(sp)) /* End perl. */
+ rval = 1;
+#endif
if (v_screen_end(sp)) /* End vi. */
rval = 1;
if (ex_screen_end(sp)) /* End ex. */
diff --git a/usr.bin/vi/common/screen.h b/usr.bin/vi/common/screen.h
index 141d50703b6..bb7254f62a2 100644
--- a/usr.bin/vi/common/screen.h
+++ b/usr.bin/vi/common/screen.h
@@ -6,7 +6,7 @@
*
* See the LICENSE file for redistribution information.
*
- * @(#)screen.h 10.22 (Berkeley) 6/30/96
+ * @(#)screen.h 10.24 (Berkeley) 7/19/96
*/
/*
@@ -89,6 +89,7 @@ struct _scr {
void *ex_private; /* Ex private area. */
void *vi_private; /* Vi private area. */
+ void *perl_private; /* Perl private area. */
/* PARTIALLY OR COMPLETELY COPIED FROM PREVIOUS SCREEN. */
char *alt_name; /* Ex/vi: alternate file name. */
@@ -194,8 +195,9 @@ struct _scr {
#define SC_RE_SEARCH 0x00400000 /* Search RE has been compiled. */
#define SC_RE_SUBST 0x00800000 /* Substitute RE has been compiled. */
#define SC_SCRIPT 0x01000000 /* Shell script window. */
-#define SC_STATUS 0x02000000 /* Schedule welcome message. */
-#define SC_TINPUT 0x04000000 /* Doing text input. */
-#define SC_TINPUT_INFO 0x08000000 /* Doing text input on info line. */
+#define SC_STATUS 0x02000000 /* Welcome message. */
+#define SC_STATUS_CNT 0x04000000 /* Welcome message plus file count. */
+#define SC_TINPUT 0x08000000 /* Doing text input. */
+#define SC_TINPUT_INFO 0x10000000 /* Doing text input on info line. */
u_int32_t flags;
};