summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f298173)
now, DO_COMPRESS. This controls whether or not catpages are compressed or
not (on by default, since little else uses the catpages and those few things
that do can always configure in a `zmore' in place of more or something, and
saving space is more important, IMHO).
Uncompression support is now on by default since that's the only way to support
mixed-mode environments. If you don't like it, just don't compress your man
pages and it won't be used! :-). Supports gzip. You can also compress
the man pages themselves (or gzip them) now and it will work.
grap= # no grap
pic= /usr/bin/pic
zcat= /usr/bin/zcat
grap= # no grap
pic= /usr/bin/pic
zcat= /usr/bin/zcat
+compress= gzip -c
+compext= .gz
# For scripts.
.if !target(obj)
# For scripts.
.if !target(obj)
-obj cleandir clean depend rcsfreeze tags all:
- @echo -n
+NOMAN= noman
+CLEANFILES= catman
-install:
- install -c -o bin -g bin -m 555 catman ${DESTDIR}/usr/bin
+beforeinstall: catman
+ install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
+ ${.CURDIR}/catman ${DESTDIR}${BINDIR}
-.include "../Makefile.inc"
+
+catman: catman.sh
+ sed -e 's,%compress%,${compress},' \
+ -e 's,%compext%,${compext},' \
+ -e 's,%zcat%,${zcat},' \
+ ${.CURDIR}/catman.sh > catman
+
CONFH= ${.CURDIR}/config.h
.endif
CONFH= ${.CURDIR}/config.h
.endif
-CFLAGS+= -I${.CURDIR} -DSTDC_HEADERS -DPOSIX -DHAS_TROFF -DDO_UNCOMPRESS -DALT_SYSTEMS
+CFLAGS+= -I${.CURDIR} -DSTDC_HEADERS -DPOSIX -DHAS_TROFF -DDO_COMPRESS -DALT_SYSTEMS
CLEANFILES+= ${CONFH}
SRCS = util.c gripes.c
CLEANFILES+= ${CONFH}
SRCS = util.c gripes.c
-e 's,%vgrind%,${vgrind},' -e 's,%refer%,${refer},' \
-e 's,%grap%,${grap},' -e 's,%zcat%,${zcat},' \
-e 's,%manpath_config_file%,${manpath_config_file},' \
-e 's,%vgrind%,${vgrind},' -e 's,%refer%,${refer},' \
-e 's,%grap%,${grap},' -e 's,%zcat%,${zcat},' \
-e 's,%manpath_config_file%,${manpath_config_file},' \
+ -e 's,%compress%,${compress},' \
+ -e 's,%compext%,${compext},' \
${.CURDIR}/config.h_dist > ${CONFH}
.include <bsd.lib.mk>
${.CURDIR}/config.h_dist > ${CONFH}
.include <bsd.lib.mk>
-#ifdef COMPRESS
-#define DO_COMPRESS
-#define DO_UNCOMPRESS
-#endif
-
/*
* This is the size of a number of internal buffers. It should
* probably not be less than 512.
/*
* This is the size of a number of internal buffers. It should
* probably not be less than 512.
/*
* Define the uncompression program(s) to use for those preformatted
* pages that end in the given character. If you add extras here, you
/*
* Define the uncompression program(s) to use for those preformatted
* pages that end in the given character. If you add extras here, you
- * may need to change man.c.
+ * may need to change man.c. [I have no idea what FCAT and YCAT files
+ * are! - I will leave them in for now.. -jkh]
/* .F files */
#define FCAT ""
/* .Y files */
#define YCAT ""
/* .Z files */
#define ZCAT "%zcat%"
/* .F files */
#define FCAT ""
/* .Y files */
#define YCAT ""
/* .Z files */
#define ZCAT "%zcat%"
/*
* This is the standard program to use on this system for compressing
* pages once they have been formatted, and the character to tack on
* to the end of those files. The program listed is expected to read
* from the standard input and write compressed output to the standard
/*
* This is the standard program to use on this system for compressing
* pages once they have been formatted, and the character to tack on
* to the end of those files. The program listed is expected to read
* from the standard input and write compressed output to the standard
+ * output. These won't actually be used unless compression is enabled.
-#define COMPRESSOR ""
-#define COMPRESS_EXT ""
+#define COMPRESSOR "%compress%"
+#define COMPRESS_EXT "%compext%"
beforeinstall: makewhatis
install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
beforeinstall: makewhatis
install -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
- ${.CURDIR}/makewhatis.sh ${DESTDIR}${BINDIR}/makewhatis
+ ${.CURDIR}/makewhatis ${DESTDIR}${BINDIR}
.include <bsd.prog.mk>
makewhatis: makewhatis.sh
sed -e 's/%sections%/ "1", "n", "l", "6", "8", "2", "3", "4", "5", "7", "p", "o", NULL/' \
.include <bsd.prog.mk>
makewhatis: makewhatis.sh
sed -e 's/%sections%/ "1", "n", "l", "6", "8", "2", "3", "4", "5", "7", "p", "o", NULL/' \
+ -e 's,%zcat%,${zcat},' \
+ -e 's,%compext%,${compext},' \
${.CURDIR}/makewhatis.sh > makewhatis
${.CURDIR}/makewhatis.sh > makewhatis
then
for f in `find $subdir -type f -print`
do
then
for f in `find $subdir -type f -print`
do
+ suffix=`echo $f | sed -e 's/.*\\.//'`
+ if [ ".$suffix" = "%compext%" ]; then
+ output=%zcat%
+ else
+ output=cat
+ fi
+ $output $f | \
sed -n '/^\.TH.*$/p
/^\.Dt.*$/p
sed -n '/^\.TH.*$/p
/^\.Dt.*$/p
- /^\.S[hH][ ]*NAME/,/^\.S[hH]/p' $f |\
+ /^\.S[hH][ ]*NAME/,/^\.S[hH]/p'|\
sed -e 's/\\[ ]*\-/-/
s/^.P[Pp].*$//
s/\\(em//
sed -e 's/\\[ ]*\-/-/
s/^.P[Pp].*$//
s/\\(em//
DPADD+= ${MAN1}
CFLAGS+= -I${.CURDIR}/../lib -DSTDC_HEADERS -DPOSIX -DHAS_TROFF
DPADD+= ${MAN1}
CFLAGS+= -I${.CURDIR}/../lib -DSTDC_HEADERS -DPOSIX -DHAS_TROFF
-CFLAGS+= -DDO_UNCOMPRESS -DALT_SYSTEMS -DSETREUID -DCATMODE=0664
+CFLAGS+= -DDO_COMPRESS -DALT_SYSTEMS -DSETREUID -DCATMODE=0664
CLEANFILES+= ${MAN1}
${MAN1}: ${.CURDIR}/man.man
sed -e 's,%libdir%,${libdir},' -e 's,%bindir%,${bindir},' \
-e 's,%pager%,${pager},' -e 's,%troff%,${troff},' \
-e 's,%manpath_config_file%,${manpath_config_file},' \
CLEANFILES+= ${MAN1}
${MAN1}: ${.CURDIR}/man.man
sed -e 's,%libdir%,${libdir},' -e 's,%bindir%,${bindir},' \
-e 's,%pager%,${pager},' -e 's,%troff%,${troff},' \
-e 's,%manpath_config_file%,${manpath_config_file},' \
+ -e 's,%compress%,${compress},' \
${.CURDIR}/man.man > ${MAN1}
.include <bsd.prog.mk>
${.CURDIR}/man.man > ${MAN1}
.include <bsd.prog.mk>
if (to_cat)
{
int len = strlen (name) + 3;
if (to_cat)
{
int len = strlen (name) + 3;
+ int cextlen = strlen(COMPRESS_EXT);
+
to_name = (char *) malloc (len);
if (to_name == NULL)
gripe_alloc (len, "to_name");
strcpy (to_name, name);
to_name = (char *) malloc (len);
if (to_name == NULL)
gripe_alloc (len, "to_name");
strcpy (to_name, name);
- strcat (to_name, ".Z");
+ /* Avoid tacking it on twice */
+ if (strcmp(name + (len - (3 + cextlen)), COMPRESS_EXT))
+ strcat (to_name, COMPRESS_EXT);
}
else
to_name = strdup (name);
}
else
to_name = strdup (name);
char *
get_expander (file)
char *file;
{
char *
get_expander (file)
char *file;
{
- char *expander = NULL;
- int len = strlen (file);
+ char *end = file + (strlen (file) - 1);
- if (file[len - 2] == '.')
- {
- switch (file[len - 1])
- {
+ while (end > file && end[-1] != '.')
+ --end;
+ if (end == file)
+ return NULL;
- case 'F':
- if (strcmp (FCAT, "") != 0)
- expander = strdup (FCAT);
- break;
-#endif
+ if (*end == 'F')
+ return FCAT;
+#endif /* FCAT */
- case 'Y':
- if (strcmp (YCAT, "") != 0)
- expander = strdup (YCAT);
- break;
-#endif
+ if (*end == 'Y')
+ return YCAT;
+#endif /* YCAT */
- case 'Z':
- if (strcmp (ZCAT, "") != 0)
- expander = strdup (ZCAT);
- break;
-#endif
- default:
- break;
- }
- }
- return expander;
+ if (*end == 'Z' || !strcmp(end, "gz"))
+ return ZCAT;
+#endif /* ZCAT */
+ return NULL;
/*
* Simply display the preformatted page.
/*
* Simply display the preformatted page.
if (access (file, R_OK) == 0)
{
if (access (file, R_OK) == 0)
{
char *expander = get_expander (file);
if (expander != NULL)
sprintf (command, "%s %s | %s", expander, file, pager);
else
sprintf (command, "%s %s", pager, file);
char *expander = get_expander (file);
if (expander != NULL)
sprintf (command, "%s %s | %s", expander, file, pager);
else
sprintf (command, "%s %s", pager, file);
-#else
- sprintf (command, "%s %s", pager, file);
-#endif
found = do_system_command (command);
}
found = do_system_command (command);
}
strcat (buf, " | ");
strcat (buf, NROFF);
}
strcat (buf, " | ");
strcat (buf, NROFF);
}
if (tbl_found && !troff && strcmp (COL, "") != 0)
{
strcat (buf, " | ");
if (tbl_found && !troff && strcmp (COL, "") != 0)
{
strcat (buf, " | ");
if (debug)
fprintf (stderr, "using default preprocessor sequence\n");
if (debug)
fprintf (stderr, "using default preprocessor sequence\n");
+ if ((cp = get_expander(file)) == NULL)
+ cp = "cat";
+ sprintf(buf, "%s %s | ", cp, file);
#ifdef HAS_TROFF
if (troff)
{
if (strcmp (TBL, "") != 0)
{
#ifdef HAS_TROFF
if (troff)
{
if (strcmp (TBL, "") != 0)
{
- strcpy (buf, TBL);
- strcat (buf, " ");
- strcat (buf, file);
strcat (buf, " | ");
strcat (buf, TROFF);
}
else
{
strcat (buf, " | ");
strcat (buf, TROFF);
}
else
{
- strcpy (buf, TROFF);
- strcat (buf, " ");
- strcat (buf, file);
{
if (strcmp (TBL, "") != 0)
{
{
if (strcmp (TBL, "") != 0)
{
- strcpy (buf, TBL);
- strcat (buf, " ");
- strcat (buf, file);
strcat (buf, " | ");
strcat (buf, NROFF);
}
else
{
strcpy (buf, NROFF);
strcat (buf, " | ");
strcat (buf, NROFF);
}
else
{
strcpy (buf, NROFF);
- strcat (buf, " ");
- strcat (buf, file);
}
if (strcmp (COL, "") != 0)
}
if (strcmp (COL, "") != 0)
#endif
/*
* Don't let the user interrupt the system () call and screw up
#endif
/*
* Don't let the user interrupt the system () call and screw up
- * the formmatted man page if we're not done yet.
+ * the formatted man page if we're not done yet.
*/
fprintf (stderr, "Formatting page, please wait...");
fflush(stderr);
*/
fprintf (stderr, "Formatting page, please wait...");
fflush(stderr);
only looks in that section of the manual. You may also specify the
order to search the sections for entries and which preprocessors to
run on the source files via command line options or environment
only looks in that section of the manual. You may also specify the
order to search the sections for entries and which preprocessors to
run on the source files via command line options or environment
+variables. If enabled by the system administrator, formatted man
+pages will also be compressed with the `%compress%' command to save
+space.
.SH OPTIONS
.TP
.B \-\^M " path"
.SH OPTIONS
.TP
.B \-\^M " path"