summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Labrecque <vincent@cvs.openbsd.org>2002-05-29 12:32:52 +0000
committerVincent Labrecque <vincent@cvs.openbsd.org>2002-05-29 12:32:52 +0000
commitca39846b127a826a0fde66543a39c860b239d640 (patch)
tree2f43fc94ddbf24ffe108be0c86a5417cb26ab34b
parent032734d23809772db89c0c6142f42d6404a743a6 (diff)
add a function to visit a file read-only mapped to C-x C-v
ok art@
-rw-r--r--usr.bin/mg/def.h3
-rw-r--r--usr.bin/mg/file.c13
-rw-r--r--usr.bin/mg/keymap.c4
3 files changed, 16 insertions, 4 deletions
diff --git a/usr.bin/mg/def.h b/usr.bin/mg/def.h
index 59c79bf3273..f899d71a2e0 100644
--- a/usr.bin/mg/def.h
+++ b/usr.bin/mg/def.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: def.h,v 1.39 2002/03/18 01:45:54 vincent Exp $ */
+/* $OpenBSD: def.h,v 1.40 2002/05/29 12:32:51 vincent Exp $ */
#include <sys/queue.h>
@@ -330,6 +330,7 @@ int d_rename(int, int);
/* file.c X */
int fileinsert(int, int);
int filevisit(int, int);
+int filevisitro(int, int);
int poptofile(int, int);
BUFFER *findbuffer(char *);
int readin(char *);
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index c86a3d0254e..a26922e4c22 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.16 2002/03/16 04:17:36 vincent Exp $ */
+/* $OpenBSD: file.c,v 1.17 2002/05/29 12:32:51 vincent Exp $ */
/*
* File commands.
@@ -54,6 +54,17 @@ filevisit(int f, int n)
return TRUE;
}
+int
+filevisitro(int f, int n)
+{
+ int error;
+
+ error = filevisit(f, n);
+ if (error != TRUE)
+ return (error);
+ curbp->b_flag |= BFREADONLY;
+ return (TRUE);
+}
/*
* Pop to a file in the other window. Same as the last function, but uses
* popbuf instead of showbuffer.
diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c
index b0258571c60..2331845a579 100644
--- a/usr.bin/mg/keymap.c
+++ b/usr.bin/mg/keymap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keymap.c,v 1.19 2002/03/11 13:02:56 vincent Exp $ */
+/* $OpenBSD: keymap.c,v 1.20 2002/05/29 12:32:51 vincent Exp $ */
/*
* Keyboard maps. This is character set dependent. The terminal specific
@@ -84,7 +84,7 @@ static PF cXcL[] = {
filesave, /* ^S */
rescan, /* ^T */
upperregion, /* ^U */
- rescan, /* ^V */
+ filevisitro, /* ^V */
filewrite, /* ^W */
swapmark, /* ^X */
};