summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-10-16 10:40:11 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-10-16 10:40:11 +0000
commit56da29cc1652edc5bb1942e9c0aa109fd0b7bd97 (patch)
tree1efe13eb5d8b8d6270e1dbbb1cd65eb4535d8cec /sbin
parente18ada7a5a86b022159122b289a55197f022e7cd (diff)
new command: M (shows linked-in manpage)
Diffstat (limited to 'sbin')
-rw-r--r--sbin/disklabel/Makefile9
-rw-r--r--sbin/disklabel/editor.c15
2 files changed, 20 insertions, 4 deletions
diff --git a/sbin/disklabel/Makefile b/sbin/disklabel/Makefile
index 9d700cfe36e..26d819ca752 100644
--- a/sbin/disklabel/Makefile
+++ b/sbin/disklabel/Makefile
@@ -1,11 +1,16 @@
-# $OpenBSD: Makefile,v 1.12 1997/10/13 15:02:14 pefo Exp $
+# $OpenBSD: Makefile,v 1.13 1997/10/16 10:40:09 deraadt Exp $
PROG= disklabel
-SRCS= disklabel.c dkcksum.c editor.c
+SRCS= disklabel.c dkcksum.c editor.c manual.c
DPADD= ${LIBUTIL}
LDADD= -lutil
MAN= disklabel.5 disklabel.8
+manual.c: ${.OBJDIR}/disklabel.cat8
+ (echo 'char manpage[] = "\\'; \
+ sed -e 's/$$/\\n\\/' ${.OBJDIR}/disklabel.cat8; \
+ echo '";' ) > manual.c
+
.if ${MACHINE} == "amiga"
CFLAGS+= -D${MACHINE}
.endif
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index 70af6bf4bb1..d30afe20ed0 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.13 1997/10/16 02:41:34 deraadt Exp $ */
+/* $OpenBSD: editor.c,v 1.14 1997/10/16 10:40:10 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.13 1997/10/16 02:41:34 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.14 1997/10/16 10:40:10 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -140,6 +140,7 @@ editor(lp, f)
puts("\tw - write label to disk.");
puts("\tq - quit and save changes.");
puts("\tx - exit without saving changes.");
+ puts("\tM - show entire OpenBSD man page for disklabel.");
puts("\t? - this message.\n");
puts("Numeric parameters may use suffixes to indicate units:\n\t'b' for bytes, 'c' for cylinders, 'k' for kilobytes, 'm' for megabytes,\n\t'g' for gigabytes or no suffix for blocks (usually 512 bytes).\n\tNon-block units will be rounded to the nearest cylinder.\nThe (optional) argument to p[rint] may be one of the aforementioned units.\n");
break;
@@ -180,6 +181,16 @@ editor(lp, f)
editor_display(&label, &freeblocks, arg ? *arg : 0);
break;
+ case 'M':
+ fp = popen("/usr/bin/less", "w");
+ if (fp) {
+ extern char manpage[];
+
+ (void) fwrite(manpage, strlen(manpage), 1, fp);
+ pclose(fp);
+ }
+ break;
+
case 'q':
if (donothing) {
puts("In no change mode, not writing label.");