summaryrefslogtreecommitdiff
path: root/usr.bin/mg/buffer.c
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-03-09 16:20:49 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2005-03-09 16:20:49 +0000
commit34684c50a88034a63d96b0b8f54c590094fdca6f (patch)
treec381c1c4c09f76b66de332fdb0243d1df4bdff9c /usr.bin/mg/buffer.c
parent51e684432edb921bd1a5233896eb5be1c3cdcdbb (diff)
fix mg's behaviour with regards to files on which we do not have
write access. diff originally from vincent@ and forgotten for a while. ok rohee@, "toss it in, i'll bitch if it doesn't work" henning@
Diffstat (limited to 'usr.bin/mg/buffer.c')
-rw-r--r--usr.bin/mg/buffer.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index c67d801c828..0d533ffd1ba 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.34 2004/07/22 01:25:24 vincent Exp $ */
+/* $OpenBSD: buffer.c,v 1.35 2005/03/09 16:20:48 jfb Exp $ */
/*
* Buffer handling.
@@ -102,12 +102,9 @@ poptobuffer(int f, int n)
*/
/* ARGSUSED */
int
-killbuffer(int f, int n)
+killbuffer_cmd(int f, int n)
{
BUFFER *bp;
- BUFFER *bp1;
- BUFFER *bp2;
- MGWIN *wp;
char bufn[NBUFN], *bufp;
if ((bufp = eread("Kill buffer: (default %s) ", bufn, NBUFN, EFNEW | EFBUF,
@@ -117,6 +114,15 @@ killbuffer(int f, int n)
bp = curbp;
else if ((bp = bfind(bufn, FALSE)) == NULL)
return FALSE;
+ return killbuffer(bp);
+}
+
+int
+killbuffer(BUFFER *bp)
+{
+ BUFFER *bp1;
+ BUFFER *bp2;
+ MGWIN *wp;
/*
* Find some other buffer to display. try the alternate buffer,