bin/52213: catman compresses with wrong program if source files
are uncompressed
Ruslan Ermilov
ru at FreeBSD.org
Fri May 16 02:20:14 PDT 2003
The following reply was made to PR bin/52213; it has been noted by GNATS.
From: Ruslan Ermilov <ru at FreeBSD.org>
To: Krister Joas <krister at gazonk.net>
Cc: bug-followup at FreeBSD.org
Subject: Re: bin/52213: catman compresses with wrong program if source files are uncompressed
Date: Fri, 16 May 2003 12:09:39 +0300
On Wed, May 14, 2003 at 07:24:05PM +0900, Krister Joas wrote:
>
> The following patch fixes catman so that if the source file is
> compressed the preformatted files are compressed with the same
> program as the source and if the source files are uncompressed the
> preformatted files are also uncompressed.
>
I've cleaned up your patch a bit.
%%%
Index: catman.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/catman/catman.c,v
retrieving revision 1.5
diff -u -p -r1.5 catman.c
--- catman.c 29 Oct 2002 09:20:22 -0000 1.5
+++ catman.c 16 May 2003 09:03:22 -0000
@@ -84,7 +84,7 @@ static const char *locale_device[] = {
#define BZ2_CMD "bzip2"
#define BZ2_EXT ".bz2"
#define BZ2CAT_CMD "bz"
-#define GZ_CMD "gzip -n"
+#define GZ_CMD "gzip"
#define GZ_EXT ".gz"
#define GZCAT_CMD "z"
enum Ziptype {NONE, BZIP, GZIP};
@@ -461,9 +461,11 @@ process_page(char *mandir, char *src, ch
}
snprintf(tmp_file, sizeof tmp_file, "%s.tmp", cat);
snprintf(cmd, sizeof cmd,
- "%scat %s | tbl | nroff -T%s -man | col | %s -c > %s.tmp",
+ "%scat %s | tbl | nroff -T%s -man | col | %s > %s.tmp",
zipped == BZIP ? BZ2CAT_CMD : zipped == GZIP ? GZCAT_CMD : "",
- src, nroff_device, zipped == GZIP ? GZ_CMD : BZ2_CMD, cat);
+ src, nroff_device,
+ zipped == BZIP ? BZ2_CMD : zipped == GZIP ? GZ_CMD : "cat",
+ cat);
if (system(cmd) != 0)
err(1, "formatting pipeline");
if (rename(tmp_file, cat) < 0)
@@ -541,11 +543,11 @@ scan_section(char *mandir, char *section
"warning, %s is uncompressed\n",
page_path);
}
- snprintf(cat_path, sizeof cat_path, "%s/%s%s",
- cat_section, page_name, GZ_EXT);
+ snprintf(cat_path, sizeof cat_path, "%s/%s",
+ cat_section, page_name);
if (expected != NULL) {
asprintf(&expected[nexpected++],
- "%s%s", page_name, GZ_EXT);
+ "%s", page_name);
}
process_page(mandir, page_path, cat_path, NONE);
}
%%%
--
Ruslan Ermilov Sysadmin and DBA,
ru at sunbay.com Sunbay Software AG,
ru at FreeBSD.org FreeBSD committer,
+380.652.512.251 Simferopol, Ukraine
http://www.FreeBSD.org The Power To Serve
http://www.oracle.com Enabling The Information Age
More information about the freebsd-bugs
mailing list