summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorVincent Labrecque <vincent@cvs.openbsd.org>2002-03-16 19:30:30 +0000
committerVincent Labrecque <vincent@cvs.openbsd.org>2002-03-16 19:30:30 +0000
commit79b17a9b4c1a6bc5027e1a05ef18325027b41175 (patch)
tree0be9d646e8481144cf284c17059bfcb004f4ffd3 /usr.bin
parent0cf85c22e5b84342fbb6b64c7393ddfce3ea03b5 (diff)
Make these special buffers readonly by default. ok art@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/mg/buffer.c3
-rw-r--r--usr.bin/mg/fileio.c6
-rw-r--r--usr.bin/mg/grep.c3
-rw-r--r--usr.bin/mg/help.c3
4 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index c33abfedddd..de84e267a18 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.27 2002/03/16 04:17:36 vincent Exp $ */
+/* $OpenBSD: buffer.c,v 1.28 2002/03/16 19:30:29 vincent Exp $ */
/*
* Buffer handling.
@@ -264,6 +264,7 @@ makelist(void)
if (bclear(blp) != TRUE)
return NULL;
blp->b_flag &= ~BFCHG; /* Blow away old. */
+ blp->b_flag |= BFREADONLY;
listbuf_ncol = ncol; /* cache ncol for listbuf_goto_buffer */
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 99c449575e5..109c33e3458 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.25 2002/03/11 13:02:56 vincent Exp $ */
+/* $OpenBSD: fileio.c,v 1.26 2002/03/16 19:30:29 vincent Exp $ */
/*
* POSIX fileio.c
@@ -414,6 +414,9 @@ copy(frname, toname)
}
}
+/*
+ * dirname needs to have enough place to store an additional '/'.
+ */
BUFFER *
dired_(dirname)
char *dirname;
@@ -439,6 +442,7 @@ dired_(dirname)
}
if (bclear(bp) != TRUE)
return FALSE;
+ bp->b_flag |= BFREADONLY;
if (snprintf(line, sizeof(line), "ls -al %s", dirname) >= sizeof(line)){
ewprintf("Path too long");
return NULL;
diff --git a/usr.bin/mg/grep.c b/usr.bin/mg/grep.c
index d2db802c87f..eaea4f6a582 100644
--- a/usr.bin/mg/grep.c
+++ b/usr.bin/mg/grep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grep.c,v 1.3 2002/02/14 14:24:21 deraadt Exp $ */
+/* $OpenBSD: grep.c,v 1.4 2002/03/16 19:30:29 vincent Exp $ */
/*
* Copyright (c) 2001 Artur Grabowski <art@openbsd.org>. All rights reserved.
*
@@ -150,6 +150,7 @@ compile_mode(char *name, char *command)
bp = bfind(name, TRUE);
if (bclear(bp) != TRUE)
return NULL;
+ bp->b_flag |= BFREADONLY;
addlinef(bp, "Running (%s).", command);
addline(bp, "");
diff --git a/usr.bin/mg/help.c b/usr.bin/mg/help.c
index 65428d32f37..8b9e00c3c04 100644
--- a/usr.bin/mg/help.c
+++ b/usr.bin/mg/help.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: help.c,v 1.16 2002/03/11 13:02:56 vincent Exp $ */
+/* $OpenBSD: help.c,v 1.17 2002/03/16 19:30:29 vincent Exp $ */
/*
* Help functions for Mg 2
@@ -107,6 +107,7 @@ wallchart(f, n)
if (bclear(bp) != TRUE)
/* clear it out */
return FALSE;
+ bp->b_flag |= BFREADONLY;
for (m = curbp->b_nmodes; m > 0; m--) {
if ((addlinef(bp, "Local keybindings for mode %s:",
curbp->b_modes[m]->p_name) == FALSE) ||