summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2003-05-21 13:26:37 +0000
committerru <ru@FreeBSD.org>2003-05-21 13:26:37 +0000
commit97e3bdab83f70730f054faac81589ffdb2860d8c (patch)
tree3979c8876a1dd1bebaf76eb53fab7a9bf7902fe1 /usr.bin
parent1ac7af4ec88402db3d89cb97c4ec2511e0e935c3 (diff)
downloadFreeBSD-src-97e3bdab83f70730f054faac81589ffdb2860d8c.zip
FreeBSD-src-97e3bdab83f70730f054faac81589ffdb2860d8c.tar.gz
Fixed catman(1) so that if the source files are 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. PR: bin/52213 Submitted by: Krister Joas <krister@gazonk.net>, ru Approved by: re (jhb)
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/catman/catman.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/catman/catman.c b/usr.bin/catman/catman.c
index 66d9d7a..43b970b 100644
--- a/usr.bin/catman/catman.c
+++ b/usr.bin/catman/catman.c
@@ -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, char *cat, enum Ziptype zipped)
}
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, char *cat_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);
}
OpenPOWER on IntegriCloud