diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-11-06 18:58:00 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-11-06 18:58:00 +0000 |
commit | e7b9f1287fa3b69e6b82148f3838cf4a47b1ac39 (patch) | |
tree | 875eeebb1f1c91f6b49498490a0a515d0d36dbbf /sbin/fdisk/cmd.c | |
parent | d342fa430e91c59a31ca21ada4b5f48d3793106f (diff) |
gzip embedded man pages, and pipe through gunzip when viewing.
ok deraadt@
Diffstat (limited to 'sbin/fdisk/cmd.c')
-rw-r--r-- | sbin/fdisk/cmd.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 9dc885c3a24..beb47b9f35b 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.36 2004/09/18 23:22:05 deraadt Exp $ */ +/* $OpenBSD: cmd.c,v 1.37 2004/11/06 18:57:59 otto Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -379,16 +379,20 @@ Xmanual(cmd_t *cmd, disk_t *disk, mbr_t *mbr, mbr_t *tt, int offset) char *pager = "/usr/bin/less"; char *p; sig_t opipe; - extern char manpage[]; + extern const char manpage[]; + extern const int manpage_sz; FILE *f; opipe = signal(SIGPIPE, SIG_IGN); if ((p = getenv("PAGER")) != NULL && (*p != '\0')) pager = p; - f = popen(pager, "w"); - if (f) { - (void) fwrite(manpage, strlen(manpage), 1, f); - pclose(f); + if (asprintf(&p, "gunzip -qc|%s", pager) != -1) { + f = popen(p, "w"); + if (f) { + (void) fwrite(manpage, manpage_sz, 1, f); + pclose(f); + } + free(p); } (void)signal(SIGPIPE, opipe); |