diff options
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/Makefile | 14 | ||||
-rw-r--r-- | sbin/disklabel/editor.c | 16 |
2 files changed, 17 insertions, 13 deletions
diff --git a/sbin/disklabel/Makefile b/sbin/disklabel/Makefile index d579685a120..e21d059622c 100644 --- a/sbin/disklabel/Makefile +++ b/sbin/disklabel/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.33 2004/05/03 15:18:19 drahn Exp $ +# $OpenBSD: Makefile,v 1.34 2004/11/06 18:57:59 otto Exp $ PROG= disklabel SRCS= disklabel.c dkcksum.c editor.c manual.c @@ -13,14 +13,14 @@ CLEANFILES+=manual.c .ifdef NOMAN manual.c: - (echo 'char manpage[] = "\\'; \ - echo "no manual\\"; \ - echo '";' ) > manual.c + (echo 'const char manpage[] = {'; \ + echo 'no manual' | gzip -9c | hexdump -ve '"0x" 1/1 "%02x,"'; \ + echo '};'; echo 'const int manpage_sz = sizeof(manpage);') > manual.c .else manual.c: disklabel.cat8 - (echo 'char manpage[] = "\\'; \ - sed -e 's/[\\"]/\\&/g' -e 's/$$/\\n\\/' disklabel.cat8; \ - echo '";' ) > manual.c + (echo 'const char manpage[] = {'; \ + gzip -9c disklabel.cat8 | hexdump -ve '"0x" 1/1 "%02x,"'; \ + echo '};'; echo 'const int manpage_sz = sizeof(manpage);') > manual.c .endif .if (${MACHINE} == "amiga") diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 83f8d689fa5..aa81c12bfee 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.96 2004/10/04 15:09:41 otto Exp $ */ +/* $OpenBSD: editor.c,v 1.97 2004/11/06 18:57:59 otto Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -17,7 +17,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: editor.c,v 1.96 2004/10/04 15:09:41 otto Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.97 2004/11/06 18:57:59 otto Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -295,17 +295,21 @@ editor(struct disklabel *lp, int f, char *dev, char *fstabfile) case 'M': { sig_t opipe = signal(SIGPIPE, SIG_IGN); - char *pager; - extern char manpage[]; + char *pager, *cmd = NULL; + extern const char manpage[]; + extern const int manpage_sz; if ((pager = getenv("PAGER")) == NULL || *pager == '\0') pager = _PATH_LESS; - if ((fp = popen(pager, "w")) != NULL) { - (void) fwrite(manpage, strlen(manpage), 1, fp); + + if (asprintf(&cmd, "gunzip -qc|%s", pager) != -1 && + (fp = popen(cmd, "w")) != NULL) { + (void) fwrite(manpage, manpage_sz, 1, fp); pclose(fp); } else warn("unable to execute %s", pager); + free(cmd); (void)signal(SIGPIPE, opipe); break; } |