NetBSD Problem Report #626

From gnats  Sat Dec 10 09:01:32 1994
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id JAA00149 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sat, 10 Dec 1994 09:01:32 -0800
Message-Id: <199412100115.BAA19829@allegory>
Date: Sat, 10 Dec 1994 01:15:48 GMT
From: Bob Kemp <rsk@allegory.demon.co.uk>
Reply-To: rsk@allegory.demon.co.uk
To: gnats-bugs@netbsd.org
Subject: Optionally install man pages as compressed files
X-Send-Pr-Version: 3.2

>Number:         626
>Category:       misc
>Synopsis:       Optionally install man pages as compressed files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 10 09:05:05 +0000 1994
>Closed-Date:    Fri Jun 23 02:01:47 +0000 1995
>Last-Modified:  
>Originator:     Bob Kemp
>Release:        1.0
>Organization:

Bob Kemp		rsk@allegory.demon.co.uk
>Environment:

System: NetBSD allegory 1.0 NetBSD 1.0 (ALLEGORY) #0: Thu Dec 8 22:38:18 GMT 1994 root@allegory:/usr/src/sys/arch/i386/compile/ALLEGORY i386

>Description:

	It's obviously very convenient to have the manual pages online
	but they take up a lot of disk space.  For a long time I've been
	gzipping all the man pages whenever I install a new version, so
	here are some changes to allow man pages to be compressed as they
	are installed -- this also catches pages with multiple links to
	them.

	My fix is in two parts:
	o	Add two new options to install -z and -Z.
		Only the former is used here but the latter might be
		useful for shared man dirs where another host has compress
		but not gzip.  (Perhaps that's unlikely, dunno)

	o	Changes to bsd.man.mk to use the new -z option to install.

	It could all have been done in bsd.man.mk but that would have required
	far more ugly changes there, IMHO.

	Since the modified install first overwrites (say) x.0 and then
	compresses it to x.0.gz, conversion to compressed pages is easy.
	To go back, type gunzip -r /usr/share/man

	Comments?

	I've tested it by installing "install" and "libc" into a free area.

>How-To-Repeat:
>Fix:

diff -r xinstall.ORIG/install.1 xinstall/install.1
43c43
< .Op Fl cs
---
> .Op Fl cszZ
49c49
< .Op Fl cs
---
> .Op Fl cszZ
93a94,100
> .It Fl z
> Compress the target file using the GNU gzip program.
> If both -z and -Z are given, the last occurrence prevails.
> .It Fl Z
> Compress the target file using the compress program.
> If both -z and -Z are given, the last occurrence prevails.
> 
diff -r xinstall.ORIG/xinstall.c xinstall/xinstall.c
58a59
> static enum{C_GZIP, C_COMPRESS, C_NONE} docompress = C_NONE;
72c73
< 	while ((ch = getopt(argc, argv, "cg:m:o:sd")) != EOF)
---
> 	while ((ch = getopt(argc, argv, "cg:m:o:sdzZ")) != EOF)
96a98,103
> 		case 'z':
> 			docompress = C_GZIP;
> 			break;
> 		case 'Z':
> 			docompress = C_COMPRESS;
> 			break;
104,105c111,112
< 	/* copy and strip options make no sense when creating directories */
< 	if ((docopy || dostrip) && dodir)
---
> 	/* copy/compress/strip options make no sense when creating directories*/
> 	if ((docopy || dostrip || docompress != C_NONE) && dodir)
209a217,229
> 
> 	if (docompress != C_NONE) {
> 		char cmdbuf[MAXPATHLEN+14];
> 		sprintf(cmdbuf, "%s %s",
> 			(docompress==C_GZIP ? "gzip --force" : "compress -f"),
> 			to_name);
> 
> 		if (system(cmdbuf)) {
> 			(void)unlink(to_name);
> 			error(to_name);
> 			exit(1);
> 		}
> 	}




*** mk/bsd.man.mk.ORIG	Wed Oct 19 20:18:00 1994
--- mk/bsd.man.mk	Sat Dec 10 00:53:58 1994
***************
*** 16,22 ****
--- 16,28 ----
  	@nroff -mandoc ${.IMPSRC} > ${.TARGET} || ( rm -f ${.TARGET} ; false )


+ .if defined(COMPRESSMAN)
+ MINSTALL=	install -z ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
+ ZSUFFIX=	.gz
+ .else
  MINSTALL=	install ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
+ ZSUFFIX=
+ .endif

  maninstall:
  .if defined(MAN1) && !empty(MAN1)
***************
*** 86,94 ****
  		shift; \
  		dir=${DESTDIR}${MANDIR}`expr $$name : '.*\.\(.*\)'`; \
  		t=$${dir}${MANSUBDIR}/`expr $$name : '\(.*\)\..*'`.0; \
! 		echo $$t -\> $$l; \
  		rm -f $$t; \
! 		ln $$l $$t; \
  	done; true
  .endif

--- 92,100 ----
  		shift; \
  		dir=${DESTDIR}${MANDIR}`expr $$name : '.*\.\(.*\)'`; \
  		t=$${dir}${MANSUBDIR}/`expr $$name : '\(.*\)\..*'`.0; \
! 		echo $${t}${ZSUFFIX} -\> $${l}${ZSUFFIX}; \
  		rm -f $$t; \
! 		ln $${l}${ZSUFFIX} $${t}${ZSUFFIX}; \
  	done; true
  .endif

>Release-Note:
>Audit-Trail:

From: Bob Kemp <bob@allegory.demon.co.uk>
To: gnats-bugs@netbsd.org, gnats-admin@netbsd.org
Subject: Re: misc/626
Date: Sat, 18 Feb 1995 03:40:08 +0000 (GMT)


 Regarding my suggestion for installing compressed manual pages...

 I'm rather late in notifying you but please be aware that Alastair Crookes
 has privately pointed out several bugs in my code.  He also submitted a
 rather better scheme to current-users subsequently!

 Just a note to stop anyone wasting their time (and assuage (sp?) my feelings
 of guilt :-).

 Bob

State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Thu Jun 22 22:01:47 EDT 1995 
State-Changed-Why:  
change implemented, in a different way. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.