From 14decd3568107b9f9a63ee547ce425defedb1e9f865fc620d64b00eff9dbc598 Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Wed, 12 Dec 2007 17:16:54 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/man?expand=0&rev=13 --- man-db-2.4.1-security2.dif | 18 - man-db-2.4.3-6.diff.bz2 | 3 - man-db-2.4.3-chinese.dif | 105 - man-db-2.4.3-globbing.dif | 12 +- man-db-2.4.3.tar.bz2 | 3 - man-db-2.5.0-chinese.dif | 64 + ...-2.4.1-error.dif => man-db-2.5.0-error.dif | 48 +- ...ecurity4.dif => man-db-2.5.0-security4.dif | 6 +- man-db-2.5.0-zio.dif | 156 ++ man-db-2.4.3.dif => man-db-2.5.0.dif | 1825 ++++++----------- man-db-2.5.0.tar.bz2 | 3 + man-db_2.5.0-4.diff.bz2 | 3 + man.changes | 10 + man.spec | 167 +- mancoding | 54 + 15 files changed, 1022 insertions(+), 1455 deletions(-) delete mode 100644 man-db-2.4.1-security2.dif delete mode 100644 man-db-2.4.3-6.diff.bz2 delete mode 100644 man-db-2.4.3-chinese.dif delete mode 100644 man-db-2.4.3.tar.bz2 create mode 100644 man-db-2.5.0-chinese.dif rename man-db-2.4.1-error.dif => man-db-2.5.0-error.dif (51%) rename man-db-2.4.1-security4.dif => man-db-2.5.0-security4.dif (84%) create mode 100644 man-db-2.5.0-zio.dif rename man-db-2.4.3.dif => man-db-2.5.0.dif (51%) create mode 100644 man-db-2.5.0.tar.bz2 create mode 100644 man-db_2.5.0-4.diff.bz2 create mode 100644 mancoding diff --git a/man-db-2.4.1-security2.dif b/man-db-2.4.1-security2.dif deleted file mode 100644 index ceaf562..0000000 --- a/man-db-2.4.1-security2.dif +++ /dev/null @@ -1,18 +0,0 @@ ---- src/straycats.c -+++ src/straycats.c Wed Jul 9 19:33:23 2003 -@@ -366,6 +366,7 @@ - int fd; - drop_effective_privs (); - fd = create_tempfile ("zcat", &temp_name); -+ regain_effective_privs (); - if (fd == -1) { - error (0, errno, - _("warning: can't create temp file %s"), -@@ -373,7 +374,6 @@ - return 0; - } - close (fd); -- regain_effective_privs (); - } - - dbf = MYDBM_RWOPEN (database); diff --git a/man-db-2.4.3-6.diff.bz2 b/man-db-2.4.3-6.diff.bz2 deleted file mode 100644 index a4413d8..0000000 --- a/man-db-2.4.3-6.diff.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:28ef32cd88dcd486f76855a805c8028174eba816606160ae5a349d06dee6c0dc -size 22793 diff --git a/man-db-2.4.3-chinese.dif b/man-db-2.4.3-chinese.dif deleted file mode 100644 index 3f8e9a0..0000000 --- a/man-db-2.4.3-chinese.dif +++ /dev/null @@ -1,105 +0,0 @@ ---- src/encodings.c 2005-01-05 16:11:54.000000000 +0100 -+++ src/encodings.c 2007-07-26 14:25:02.000000000 +0200 -@@ -106,6 +106,11 @@ - { "cs", "ISO-8859-2", "ISO-8859-2" }, /* Czech */ - { "hr", "ISO-8859-2", "ISO-8859-2" }, /* Croatian */ - { "hu", "ISO-8859-2", "ISO-8859-2" }, /* Hungarian */ -+ { "zh_TW", "BIG5", "BIG5" }, /* Traditional Chinese */ -+ { "zh_HK", "BIG5HKSCS", "BIG5HKSCS" }, /* Traditional Chinese */ -+ { "zh_CN", "GB18030", "GB18030" }, /* Simplified Chinese */ -+ { "zh_SG", "GB18030", "GB18030" }, /* Simplified Chinese */ -+ { "zh", "GB18030", "GB18030" }, /* Simplified Chinese */ - { "ja", "EUC-JP", "EUC-JP" }, /* Japanese */ - { "ko", "EUC-KR", "EUC-KR" }, /* Korean */ - { "pl", "ISO-8859-2", "ISO-8859-2" }, /* Polish */ -@@ -136,6 +141,9 @@ - - #ifdef MULTIBYTE_GROFF - { "EUC-JP", "nippon" }, -+ { "GB18030", "nippon" }, -+ { "BIG5", "nippon" }, -+ { "BIG5HKSCS", "nippon" }, - #endif /* MULTIBYTE_GROFF */ - - { NULL, NULL } -@@ -170,7 +178,7 @@ - - #ifdef MULTIBYTE_GROFF - { "ascii8", NULL, NULL }, -- { "nippon", "EUC-JP", "EUC-JP" }, -+ { "nippon", NULL, NULL }, - #endif /* MULTIBYTE_GROFF */ - - { NULL, NULL, NULL } -@@ -193,6 +201,7 @@ - { "UTF-8", "utf-8" }, - - #ifdef MULTIBYTE_GROFF -+ { "GB18030", "zh" }, - { "EUC-JP", "ja" }, - { "KOI8-R", "koi8-r" }, - #endif /* MULTIBYTE_GROFF */ -@@ -283,6 +292,13 @@ - * roff encoding = UTF-8 - * output encoding = UTF-8 - * EUC-JP -> iconv -> UTF-8 -> groff -Tutf8 -> UTF-8 -+ * -+ * /usr/share/man/zh_CN.GB18030, locale zh_CN.UTF-8 -+ * page encoding = GB18030 -+ * source encoding = GB18030 -+ * roff encoding = UTF-8 -+ * output encoding = UTF-8 -+ * GB18030 -> iconv -> UTF-8 -> groff -Tutf8 -> UTF-8 - */ - const char *get_source_encoding (const char *lang) - { -@@ -386,10 +402,14 @@ - return 1; - - #ifdef MULTIBYTE_GROFF -- /* Special case for ja_JP.UTF-8, which takes UTF-8 input recoded -- * from EUC-JP and produces UTF-8 output. This is rather filthy. -+ /* Special case for ja_JP.UTF-8, zh_CN.UTF-8, zh_TW.UTF-8, and zh_HK.UTF-8 which -+ * takes UTF-8 input recoded from EUC-JP, BIG5, BIG5HKSCS, GB18030, or GBK -+ * and produces UTF-8 output. -+ * This is rather filthy. - */ -- if (STREQ (input, "EUC-JP") && STREQ (output, "UTF-8")) -+ if ((STREQ (input, "EUC-JP") || STREQ (input, "BIG5") || STREQ (input, "BIG5HKSCS") || -+ STREQ (input, "GB18030") || STREQ (input, "GBK")) && -+ STREQ (output, "UTF-8")) - return 1; - #endif /* MULTIBYTE_GROFF */ - -@@ -449,14 +469,26 @@ - #ifdef MULTIBYTE_GROFF - /* An ugly special case is needed here. The utf8 device normally - * takes ISO-8859-1 input. However, with the multibyte patch, when -- * recoding from EUC-JP it takes UTF-8 input instead. This is evil, -- * but there's not much that can be done about it apart from waiting -- * for groff 2.0. -+ * recoding from EUC-JP, GB18030, BIG5, or BIG5HKSCS it takes UTF-8 input -+ * instead. This is evil, but there's not much that can be done -+ * about it apart from waiting for groff 2.0. -+ * - */ -+ /* -+ * don't try to convert to UTF-8, the input might be UTF-8 already -+ * and groff 1.18.1.1 with the multibyte patch doesn't want -+ * UTF-8 input anyway, the /usr/bin/nroff script contains -+ * a hack to convert back to the appropriate legacy encoding -+ * if it gets UTF-8 input. -+ */ - if (STREQ (device, "utf8")) { - const char *ctype = setlocale (LC_CTYPE, NULL); -- if (STREQ (ctype, "ja_JP.UTF-8")) -- roff_encoding = "UTF-8"; -+ if (STREQ (ctype, "ja_JP.UTF-8") || -+ STREQ (ctype, "zh_CN.UTF-8") || -+ STREQ (ctype, "zh_SG.UTF-8") || -+ STREQ (ctype, "zh_TW.UTF-8") || -+ STREQ (ctype, "zh_HK.UTF-8")) -+ roff_encoding = source_encoding; /* "UTF-8"; */ - } - #endif /* MULTIBYTE_GROFF */ - diff --git a/man-db-2.4.3-globbing.dif b/man-db-2.4.3-globbing.dif index 1ecbe36..3fd3f7a 100644 --- a/man-db-2.4.3-globbing.dif +++ b/man-db-2.4.3-globbing.dif @@ -1,16 +1,6 @@ --- src/globbing.c +++ src/globbing.c 2007-09-19 13:35:04.128822519 +0200 -@@ -28,7 +28,9 @@ - #endif /* HAVE_CONFIG_H */ - - /* Need _GNU_SOURCE for FNM_CASEFOLD. */ -+#ifndef _GNU_SOURCE - #define _GNU_SOURCE -+#endif - - #include - -@@ -340,13 +342,22 @@ char **look_for_file (const char *unesc_ +@@ -340,13 +340,22 @@ char **look_for_file (const char *unesc_ /* allow lookups like "3x foo" to match "../man3/foo.3x" */ if ((layout & LAYOUT_GNU) && CTYPE (isdigit, *sec) && sec[1] != '\0') { diff --git a/man-db-2.4.3.tar.bz2 b/man-db-2.4.3.tar.bz2 deleted file mode 100644 index 4d74ef0..0000000 --- a/man-db-2.4.3.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:be7487221716d5f53ca93c9fe373b33b6703626ee47d973e59128decab501b5e -size 636060 diff --git a/man-db-2.5.0-chinese.dif b/man-db-2.5.0-chinese.dif new file mode 100644 index 0000000..1f5a4f8 --- /dev/null +++ b/man-db-2.5.0-chinese.dif @@ -0,0 +1,64 @@ +--- src/encodings.c ++++ src/encodings.c 2007-12-07 19:12:54.428222452 +0100 +@@ -110,6 +110,11 @@ static struct directory_entry directory_ + { "cs", "ISO-8859-2", "ISO-8859-2" }, /* Czech */ + { "hr", "ISO-8859-2", "ISO-8859-2" }, /* Croatian */ + { "hu", "ISO-8859-2", "ISO-8859-2" }, /* Hungarian */ ++ { "zh_TW", "BIG5", "BIG5" }, /* Traditional Chinese */ ++ { "zh_HK", "BIG5HKSCS", "BIG5HKSCS" }, /* Traditional Chinese */ ++ { "zh_CN", "GB18030", "GB18030" }, /* Simplified Chinese */ ++ { "zh_SG", "GB18030", "GB18030" }, /* Simplified Chinese */ ++ { "zh", "GB18030", "GB18030" }, /* Simplified Chinese */ + { "ja", "EUC-JP", "EUC-JP" }, /* Japanese */ + { "ko", "EUC-KR", "EUC-KR" }, /* Korean */ + { "pl", "ISO-8859-2", "ISO-8859-2" }, /* Polish */ +@@ -209,6 +214,7 @@ static struct charset_entry charset_tabl + { "BIG5HKSCS", "nippon" }, + { "EUC-CN", "nippon" }, + { "EUC-JP", "nippon" }, ++ { "GB18030", "nippon" }, + { "GBK", "nippon" }, + #endif /* MULTIBYTE_GROFF */ + +@@ -267,6 +273,7 @@ static struct less_charset_entry less_ch + { "UTF-8", "utf-8" }, + + #ifdef MULTIBYTE_GROFF ++ { "GB18030", "zh" }, + { "EUC-JP", "ja" }, + { "KOI8-R", "koi8-r" }, + #endif /* MULTIBYTE_GROFF */ +@@ -391,6 +398,13 @@ char *get_page_encoding (const char *lan + * roff encoding = UTF-8 + * output encoding = UTF-8 + * EUC-JP -> iconv -> UTF-8 -> groff -Tutf8 -> UTF-8 ++ * ++ * /usr/share/man/zh_CN.GB18030, locale zh_CN.UTF-8 ++ * page encoding = GB18030 ++ * source encoding = GB18030 ++ * roff encoding = UTF-8 ++ * output encoding = UTF-8 ++ * GB18030 -> iconv -> UTF-8 -> groff -Tutf8 -> UTF-8 + */ + const char *get_source_encoding (const char *lang) + { +@@ -524,8 +538,8 @@ static int compatible_encodings (const c + * rather filthy. + */ + if ((STREQ (input, "BIG5") || STREQ (input, "BIG5HKSCS") || +- STREQ (input, "EUC-JP") || +- STREQ (input, "EUC-CN") || STREQ (input, "GBK")) && ++ STREQ (input, "EUC-JP") || STREQ (input, "EUC-CN") || ++ STREQ (input, "GB18030") || STREQ (input, "GBK")) && + STREQ (output, "UTF-8")) + return 1; + #endif /* MULTIBYTE_GROFF */ +@@ -600,7 +614,7 @@ const char *get_roff_encoding (const cha + STREQ (ctype, "zh_HK.UTF-8") || + STREQ (ctype, "zh_SG.UTF-8") || + STREQ (ctype, "zh_TW.UTF-8")) +- roff_encoding = "UTF-8"; ++ roff_encoding = source_encoding; /* "UTF-8"; */ + } + #endif /* MULTIBYTE_GROFF */ + diff --git a/man-db-2.4.1-error.dif b/man-db-2.5.0-error.dif similarity index 51% rename from man-db-2.4.1-error.dif rename to man-db-2.5.0-error.dif index 26ac5c7..66887d3 100644 --- a/man-db-2.4.1-error.dif +++ b/man-db-2.5.0-error.dif @@ -1,6 +1,6 @@ --- lib/error.c -+++ lib/error.c Fri Mar 16 16:48:40 2001 -@@ -69,12 +69,15 @@ ++++ lib/error.c 2007-12-07 18:50:29.332479427 +0100 +@@ -76,12 +76,15 @@ private_strerror (errnum) #define strerror private_strerror #endif @@ -16,38 +16,22 @@ void #if defined(VA_START) && __STDC__ error (int status, int errnum, const char *message, ...) -@@ -117,3 +120,4 @@ - if (status) +@@ -137,3 +140,4 @@ error (status, errnum, message, va_alist exit (status); + } } +#endif --- lib/error.h -+++ lib/error.h Fri Mar 16 16:45:18 2001 -@@ -7,10 +7,11 @@ - extern int errno; - #endif - -+/* Use error() function of glibc */ - #if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT) --void error (int, int, const char *, ...); -+extern void error (int, int, const char *, ...); - #else --void error (); -+extern void error (); - #endif - - #endif ---- lib/xmalloc.c -+++ lib/xmalloc.c Fri Mar 16 16:45:37 2001 -@@ -44,9 +44,9 @@ - int xmalloc_exit_failure = EXIT_FAILURE; - - #if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT) --void error (int, int, const char *, ...); -+extern void error (int, int, const char *, ...); - #else --void error (); -+extern void error (); - #endif - ++++ lib/error.h 2007-12-07 18:51:53.803262466 +0100 +@@ -29,9 +29,9 @@ extern int errno; #include "manconfig.h" + + #if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT) +-void error (int, int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(3, 4); ++extern void error (int, int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF(3, 4); + #else +-void error (); ++extern void error (); + #endif + + #endif diff --git a/man-db-2.4.1-security4.dif b/man-db-2.5.0-security4.dif similarity index 84% rename from man-db-2.4.1-security4.dif rename to man-db-2.5.0-security4.dif index 6e73e6f..34c825c 100644 --- a/man-db-2.4.1-security4.dif +++ b/man-db-2.5.0-security4.dif @@ -1,14 +1,14 @@ --- src/mandb.c -+++ src/mandb.c Fri Jul 11 17:48:41 2003 ++++ src/mandb.c 2007-12-07 18:59:06.546515903 +0100 @@ -34,6 +34,7 @@ #include #include #include /* for chmod() */ +#include /* for open () */ + #include #if defined(STDC_HEADERS) - # include -@@ -328,11 +331,20 @@ +@@ -393,11 +394,20 @@ static short mandb (const char *catpath, char pid[23]; short amount; char *dbname; diff --git a/man-db-2.5.0-zio.dif b/man-db-2.5.0-zio.dif new file mode 100644 index 0000000..cb00ee0 --- /dev/null +++ b/man-db-2.5.0-zio.dif @@ -0,0 +1,156 @@ +--- config.h.in ++++ config.h.in 2007-12-07 15:50:22.900940943 +0100 +@@ -220,6 +220,9 @@ + /* Define to 1 if you have the `z' library (-lz). */ + #undef HAVE_LIBZ + ++/* Define to 1 if you have libzio for opening compressed manuals */ ++#undef HAVE_ZIO ++ + /* Define to 1 if you have the header file. */ + #undef HAVE_LIMITS_H + +--- configure.ac ++++ configure.ac 2007-12-07 15:55:02.636618503 +0100 +@@ -98,6 +98,18 @@ AC_ARG_WITH(config-file, + fi], + : ${config_file=\$\{sysconfdir\}/man_db.conf} + : ${config_file_basename=man_db.conf}) ++AC_ARG_WITH(zio, ++[AS_HELP_STRING([--with-zio=LIBRARY], [use zlib/libbz2 wrapper library LIBRARY (libzio)])], ++ [if test -z "$withval" -o "$withval" = "yes" ++ then ++ zio=libzio ++ elif test "$withval" = "no" ++ then ++ AC_MSG_ERROR(--with-zio requires an argument) ++ else ++ zio=$withval ++ fi], ++ : ${zio=no}) + dnl + dnl Finish the argument parsing + dnl +@@ -271,6 +283,29 @@ AC_SUBST(gunzip)dnl + AC_SUBST(uncompress)dnl + AC_SUBST(bunzip2)dnl + AC_CHECK_LIB(z, gzopen) ++dnl Check for zlib and libbz2 libraries to use this together ++dnl with SuSE's libzio to open compressed info files. ++dnl ++if test "$zio" = "no" || test -n "$zio" ++then ++ AC_CHECK_HEADER(zlib.h,[ ++ for lib in z gz ++ do ++ AC_CHECK_LIB($lib, gzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" ; break]) ++ done]) ++ AC_CHECK_HEADER(bzlib.h,[ ++ for lib in bz2 bzip2 ++ do ++ AC_CHECK_LIB($lib, BZ2_bzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" ; break]) ++ done]) ++ AC_CHECK_HEADER(zio.h,[ ++ for lib in ${zio#lib} zio ++ do ++ AC_CHECK_LIB($lib, fzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" ++ AC_DEFINE([COMP_SRC],[],[]) ++ AC_DEFINE([HAVE_ZIO],[],[])]) ++ done]) ++fi + dnl + dnl to add more decompressors just follow the scheme above. + dnl +--- lib/decompress.c ++++ lib/decompress.c 2007-12-07 18:22:47.940413890 +0100 +@@ -46,6 +46,10 @@ + # include "zlib.h" + #endif /* HAVE_LIBZ */ + ++#ifdef HAVE_ZIO ++# include "zio.h" ++#endif /* HAVE_ZIO */ ++ + #include "manconfig.h" + #include "comp_src.h" + #include "pipeline.h" +@@ -76,6 +80,32 @@ static void decompress_zlib (void *data + + #endif /* HAVE_LIBZ */ + ++#ifdef HAVE_ZIO ++ ++static void decompress_zio (void *data) ++{ ++ const char *what = (const char*)data; ++ FILE *file; ++ ++ file = fdzopen(dup (fileno (stdin)), "r", what); ++ if (!file) ++ return; ++ ++ for (;;) { ++ char buffer[4096]; ++ int r = fread(buffer, sizeof(char), sizeof(buffer), file); ++ if (r <= 0) ++ break; ++ if (fwrite (buffer, 1, (size_t) r, stdout) < (size_t) r) ++ break; ++ } ++ ++ fclose(file); ++ return; ++} ++ ++#endif /* HAVE_ZIO */ ++ + pipeline *decompress_open (const char *filename) + { + command *cmd; +@@ -87,9 +117,45 @@ pipeline *decompress_open (const char *f + char *ext; + struct compression *comp; + +- if (stat (filename, &st) < 0 && !S_ISDIR (st.st_mode)) ++ if (stat (filename, &st) < 0 || S_ISDIR (st.st_mode)) + return NULL; + ++#ifdef HAVE_ZIO ++ ext = strrchr(filename, '.'); ++ if (ext && STREQ (ext, ".gz")) { ++ /* informational only; no shell quoting concerns */ ++ char *name = strappend (NULL, "zcat < ", filename, NULL); ++ cmd = command_new_function (name, &decompress_zio, "g"); ++ free (name); ++ p = pipeline_new_commands (cmd, NULL); ++ goto got_pipeline; ++ } ++ if (ext && STREQ (ext, ".z")) { ++ /* informational only; no shell quoting concerns */ ++ char *name = strappend (NULL, "zcat < ", filename, NULL); ++ cmd = command_new_function (name, &decompress_zio, "z"); ++ free (name); ++ p = pipeline_new_commands (cmd, NULL); ++ goto got_pipeline; ++ } ++ if (ext && STREQ (ext, ".bz2")) { ++ /* informational only; no shell quoting concerns */ ++ char *name = strappend (NULL, "bzcat < ", filename, NULL); ++ cmd = command_new_function (name, &decompress_zio, "b"); ++ free (name); ++ p = pipeline_new_commands (cmd, NULL); ++ goto got_pipeline; ++ } ++ if (ext && STREQ (ext, ".Z")) { ++ /* informational only; no shell quoting concerns */ ++ char *name = strappend (NULL, "zcat < ", filename, NULL); ++ cmd = command_new_function (name, &decompress_zio, "Z"); ++ free (name); ++ p = pipeline_new_commands (cmd, NULL); ++ goto got_pipeline; ++ } ++#endif /* HAVE_ZIO */ ++ + #ifdef HAVE_LIBZ + filename_len = strlen (filename); + if (filename_len > 3 && STREQ (filename + filename_len - 3, ".gz")) { diff --git a/man-db-2.4.3.dif b/man-db-2.5.0.dif similarity index 51% rename from man-db-2.4.3.dif rename to man-db-2.5.0.dif index 7d16dd0..7f37e26 100644 --- a/man-db-2.4.3.dif +++ b/man-db-2.5.0.dif @@ -1,22 +1,23 @@ --- .pkgextract -+++ .pkgextract 2007-02-15 00:00:00.000000000 +0100 -@@ -0,0 +1,8 @@ -+bzcat ../man-db-2.4.3-6.diff.bz2 | patch -p1 -s --suffix=.debian ++++ .pkgextract 2007-12-10 12:51:40.892874000 +0100 +@@ -0,0 +1,9 @@ ++bzcat ../man-db_2.5.0-4.diff.bz2 | patch -p1 -s --suffix=.debian +patch -p0 -s --suffix=.groff < ../man-db-2.3.19deb4.0-groff.dif -+patch -p0 -s --suffix=.err < ../man-db-2.4.1-error.dif ++patch -p0 -s --suffix=.err < ../man-db-2.5.0-error.dif +patch -p0 -s --suffix=.sect < ../man-db-2.4.3-section.dif -+patch -p0 -s --suffix=.secu2 < ../man-db-2.4.1-security2.dif -+patch -p0 -s --suffix=.secu4 < ../man-db-2.4.1-security4.dif ++patch -p0 -s --suffix=.secu4 < ../man-db-2.5.0-security4.dif +patch -p0 -s --suffix=.firefox< ../man-db-2.4.3-firefox.dif -+patch -p0 -s --suffix=.chinese< ../man-db-2.4.3-chinese.dif ++patch -p0 -s --suffix=.chinese< ../man-db-2.5.0-chinese.dif ++patch -p0 -s --suffix=.glob < ../man-db-2.4.3-globbing.dif ++patch -p0 -s --suffix=.zio < ../man-db-2.5.0-zio.dif --- GNUmakefile.in -+++ GNUmakefile.in 2007-02-15 00:00:00.000000000 +0100 ++++ GNUmakefile.in 2007-12-11 12:56:21.536072000 +0100 @@ -35,7 +35,7 @@ # Make targets are: # # # # all install uninstall mostlyclean clean distclean realclean TAGS ID # --# FILES lib src man intl libdb zsoelim update RCS dist # -+# FILES lib src man libdb zsoelim update RCS dist # +-# FILES lib src man intl libdb update RCS dist # ++# FILES lib src man libdb update RCS dist # #------------------------------------------------------------------------# srcdir = @srcdir@ @@ -24,16 +25,16 @@ # GNUmakefile and include/Defines are automatic targets, don't add below. INCLUDES := config.h $(addprefix include/, manconfig.h comp_src.h) CONF = src/man_db.conf --EVERYTHING = lib intl libdb src zsoelim man po --ALL = lib intl libdb src zsoelim man po --INSTALL = src zsoelim man intl po -+EVERYTHING = lib libdb src zsoelim man po -+ALL = lib libdb src zsoelim man po -+INSTALL = src zsoelim man po +-EVERYTHING = intl lib libdb src man po +-ALL = intl lib libdb src man po +-INSTALL = src man intl po ++EVERYTHING = lib libdb src man po ++ALL = lib libdb src man po ++INSTALL = src man po include include/Defines -@@ -162,7 +162,7 @@ __TAGS: +@@ -163,7 +163,7 @@ __TAGS: install: $(INCLUDES) $(CONF) install uninstall: @@ -50,99 +51,9 @@ # Maintainers may wish to run 'make -C po update-po' beforehand. # This is not done automatically, since the .po files are stored # in revision control. ---- Makefile.Linux -+++ Makefile.Linux 2007-02-15 00:00:00.000000000 +0100 -@@ -0,0 +1,75 @@ -+# -+# -+# -+# Makefile.Linux to integrate package into source tree of SuSE Linux. -+# -+# Copyright (c) 1996-2001 SuSE GmbH Nuernberg, Germany. -+# -+# please send bugfixes or comments to feedback@suse.de. -+# -+# -+ -+ARCH = $(shell uname -m | sed 's@\(i\)[34567]\(86\)@\13\2@') -+ID = $(shell id -u) -+CFLAGS = $(RPM_OPT_FLAGS) -funroll-loops -pipe \ -+ -D_GNU_SOURCE -D_SVID_SOURCE -Wall -+MANDIR = /usr/share/man -+SYSCONFDIR = /etc -+export DESTDIR -+ -+flags = CFLAGS="$(CFLAGS)" LDFLAGS= LIBS= -+ -+GNUmakefile config.cache: -+ aclocal -+ autoconf -+ $(flags) sh configure --prefix=/usr --enable-dups \ -+ --enable-setuid=man --with-device=latin1 \ -+ --mandir=$(MANDIR) \ -+ --with-zio \ -+ --with-gnu-ld \ -+ --disable-rpath \ -+ --enable-mb-groff \ -+ --with-db=gdbm \ -+ --enable-nls \ -+ --with-config-file=$(SYSCONFDIR)/manpath.config \ -+ --without-included-gettext -+ -+compile: GNUmakefile -+ make nls=all $(flags) -+ -+install: -+ mkdir -p $(DESTDIR)/usr/lib/man-db -+ mkdir -p $(DESTDIR)/usr/bin -+ mkdir -p $(DESTDIR)/etc -+ make nls=all install $(flags) DESTDIR=$(DESTDIR) -+ { \ -+ if test -x $(DESTDIR)/usr/bin/wrapper ; then \ -+ rm -f $(DESTDIR)/usr/bin/mandb; \ -+ rm -f $(DESTDIR)/usr/bin/man; \ -+ mv $(DESTDIR)/usr/bin/wrapper $(DESTDIR)/usr/bin/mandb; \ -+ ln -sf mandb $(DESTDIR)/usr/bin/man; \ -+ fi; \ -+ if test $(ID) -eq 0 ; then \ -+ chown root.root $(DESTDIR)/usr/bin/mandb $(DESTDIR)/usr/bin/man; \ -+ chmod 4711 $(DESTDIR)/usr/bin/mandb $(DESTDIR)/usr/bin/man; \ -+ chown root.root $(DESTDIR)/usr/lib/man-db/*; \ -+ chmod 0711 $(DESTDIR)/usr/lib/man-db/*; \ -+ fi; \ -+ } -+ { \ -+ mkdir -p $(DESTDIR)/usr/share/man ; \ -+ cd $(DESTDIR)/usr/share/man ; \ -+ rm -rf *.ascii/ ; \ -+ for d in *.88591 *.eucJP ; do \ -+ mkdir -p $${d%_*} ; \ -+ (cd $${d}/ > /dev/null ; tar cfps - * ) | tar xfC - $${d%_*} ; \ -+ rm -rf $${d}/ ; \ -+ done ; \ -+ find -name '*.[1-9nlop]' | xargs gzip -9f ; \ -+ for d in `find -name manpath.5.gz -printf '%h '` ; do \ -+ ln -sf manpath.5.gz $$d/manpath.config.5.gz ; \ -+ done; \ -+ } -+ install -m 644 src/man_db.conf $(DESTDIR)/etc/manpath.config -+ sh ./mk_catdirs $(DESTDIR) -+ ---- config.h.in -+++ config.h.in 2007-02-15 00:00:00.000000000 +0100 -@@ -380,6 +380,9 @@ - /* Define to 1 if `vfork' works. */ - #undef HAVE_WORKING_VFORK - -+/* Define to 1 if you have libzio for opening compressed manuals */ -+#undef HAVE_ZIO -+ - /* Define to 1 if you have the `__argz_count' function. */ - #undef HAVE___ARGZ_COUNT - ---- configure.in -+++ configure.in 2007-07-18 15:38:24.919840000 +0200 -@@ -10,6 +10,18 @@ AC_CONFIG_HEADER(config.h) +--- configure.ac ++++ configure.ac 2007-12-10 15:33:22.410172000 +0100 +@@ -10,17 +10,30 @@ AC_CONFIG_HEADER(config.h) AC_CANONICAL_HOST AC_ARG_PROGRAM dnl @@ -160,58 +71,53 @@ +dnl dnl Define below date and version information to be put into man pages etc. dnl - datemark=20050703 -@@ -97,6 +109,18 @@ AC_ARG_WITH(config-file, - config_file=$withval - fi], - : ${config_file=\$\{sysconfdir\}/man_db.conf}) -+AC_ARG_WITH(zio, -+[ --with-zio=LIBRARY use zlib/libbz2 wrapper library LIBRARY (libzio)], -+ [if test -z "$withval" -o "$withval" = "yes" -+ then -+ zio=libzio -+ elif test "$withval" = "no" -+ then -+ AC_MSG_ERROR(--with-zio requires an argument) -+ else -+ zio=$withval -+ fi], -+ : ${zio=no}) + datemark=20071007 + date=`LANG=C date -d $datemark +'%Y-%m-%d'` + AC_SUBST(date)dnl dnl - dnl Finish the argument parsing ++m4_pattern_allow([AC_DEFINE_UNQUOTED]) + PACKAGE=AC_PACKAGE_NAME + VERSION=AC_PACKAGE_VERSION +-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", ++AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], + [Define to the name of the distribution.]) +-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", ++AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], + [Define to the version of the distribution.]) + AC_SUBST(PACKAGE)dnl + AC_SUBST(VERSION)dnl +@@ -119,9 +132,6 @@ AC_SUBST(config_file_basename)dnl dnl -@@ -118,7 +142,7 @@ AC_PATH_PROG(cat, cat) - AC_PATH_PROG(lynx, lynx, /usr/bin/lynx) - AC_PATH_PROG(tr, tr) - AC_PATH_PROG(grep, grep) --AC_PATH_PROG(pager, pager, /usr/bin/pager) -+AC_PATH_PROG(pager, less, /usr/bin/less) - test -n "$pager" && pager="$pager -s" - dnl - dnl define below (in list of preference) *roff macros to check for. -@@ -214,6 +238,14 @@ else + dnl Check $PATH for the following progs and append suitable options. + dnl +-AC_GNU_SOURCE +-AC_PROG_CC +-AC_PROG_CPP + CFLAGS="$CFLAGS -Wall" + if test "$GCC" = yes + then +@@ -232,6 +242,14 @@ else fi dnl - AC_PATH_PROGS(eqn, eqn geqn) -+AC_PATH_PROG(geqn, geqn) + MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn]) ++MAN_CHECK_PROGS([geqn], [GEQN], [use GEQN to preprocess equations], [geqn]) +dnl +dnl if geqn is found and geqn is identical with eqn we use a GNU eqn +dnl which its self can use -Tlatin1 +dnl +if test -n "$geqn" -a -n "$eqn" ; then -+ test $geqn -ef $eqn && neqn="$eqn $nroff_device" ++ test $geqn -ef $eqn && neqn="$eqn -T$nroff_device" +fi - AC_PATH_PROGS(neqn, neqn gneqn) + MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn]) dnl dnl if we fail to find an neqn, use eqn and try to force it to output -@@ -242,10 +274,16 @@ then - decompressor="$gunzip" +@@ -258,9 +276,15 @@ then + compress_ext="gz" fi - AC_PATH_PROG(compress, compress, /usr/bin/compress) + MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress]) -if test -n "$compress" +if test -n "$compress" || test -n "$gzip" then - AC_DEFINE(HAVE_COMPRESS, 1, [Define if you have compress.]) - uncompress="$compress -dc" + if test -n "$gzip" + then @@ -223,7 +129,7 @@ if test -z "$gzip" then compressor="$compress -c" -@@ -299,9 +337,6 @@ AC_ARG_ENABLE(mandirs, +@@ -334,9 +358,6 @@ AC_ARG_ENABLE(mandirs, dnl dnl check for various header files and associated libraries. dnl @@ -233,47 +139,7 @@ dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3 AC_PROG_LEX AC_HEADER_STDC -@@ -313,7 +348,7 @@ dnl - dnl Internationalization support. - dnl - AM_GNU_GETTEXT --AM_GNU_GETTEXT_VERSION(0.12.1) -+AM_GNU_GETTEXT_VERSION([0.15]) - AC_SUBST(LINGUAS)dnl - dnl - dnl Checks for structures and compiler characteristics. -@@ -336,6 +371,30 @@ MAN_FUNC_ANSI_SPRINTF - MAN_FUNC_PCLOSE - MAN_FUNC_STRSIGNAL - dnl -+dnl Check for zlib and libbz2 libraries to use this together -+dnl with SuSE's libzio to open compressed info files. -+dnl -+if test "$zio" = "no" || test -n "$zio" -+then -+ AC_CHECK_HEADER(zlib.h,[ -+ for lib in z gz -+ do -+ AC_CHECK_LIB($lib, gzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" ; break]) -+ done]) -+ AC_CHECK_HEADER(bzlib.h,[ -+ for lib in bz2 bzip2 -+ do -+ AC_CHECK_LIB($lib, BZ2_bzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" ; break]) -+ done]) -+ AC_CHECK_HEADER(zio.h,[ -+ for lib in ${zio#lib} zio -+ do -+ AC_CHECK_LIB($lib, fzopen, [LIBS="$LIBS -l$lib" ; LEXLIB="$LEXLIB -l$lib" -+ AC_DEFINE([COMP_SRC],[],[]) -+ AC_DEFINE([HAVE_ZIO],[],[])]) -+ done]) -+fi -+dnl - dnl Find a suitable database interface header and library - dnl - dnl Check for Berkeley db routines (first version API) -@@ -492,7 +551,6 @@ AC_CONFIG_FILES(GNUmakefile +@@ -529,7 +550,6 @@ AC_CONFIG_FILES(GNUmakefile include/Defines include/comp_src.h include/manconfig.h @@ -282,7 +148,7 @@ AC_OUTPUT --- mk_catdirs -+++ mk_catdirs 2007-02-15 13:13:18.000000000 +0100 ++++ mk_catdirs 2007-12-10 12:51:50.430084000 +0100 @@ -0,0 +1,24 @@ +#!/bin/sh + @@ -309,8 +175,8 @@ +test "$(id -u)" -ne 0 || chown man:daemon -R ${CACHE} + --- include/Defines.in -+++ include/Defines.in 2007-02-09 12:58:18.000000000 +0100 -@@ -97,7 +97,11 @@ DEFAULT_TARGETS = TAGS all install unins ++++ include/Defines.in 2007-12-10 12:51:50.466089000 +0100 +@@ -98,7 +98,11 @@ DEFAULT_TARGETS = TAGS all install unins debug = @debug@ date = @date@ version = @VERSION@ @@ -323,7 +189,7 @@ # some path definitions required by the manpage Makefile... pager="@pager@" --- include/comp_src.h.in -+++ include/comp_src.h.in 2007-02-15 00:00:00.000000000 +0100 ++++ include/comp_src.h.in 2007-12-10 12:51:50.498093000 +0100 @@ -53,7 +53,7 @@ struct compression comp_list[] = { #endif /* HAVE_GZIP */ @@ -334,26 +200,26 @@ #endif /* HAVE_COMPRESS */ --- include/manconfig.h.in -+++ include/manconfig.h.in 2007-07-18 15:42:54.412670497 +0200 -@@ -114,7 +114,7 @@ - #endif ++++ include/manconfig.h.in 2007-12-11 15:32:18.037124000 +0100 +@@ -73,7 +73,7 @@ - #ifndef WEB_BROWSER --# define WEB_BROWSER "exec /usr/bin/www-browser" -+# define WEB_BROWSER "exec @lynx@" - #endif + #undef MAN_DB_CREATES + #define MAN_DB_UPDATES +-#define MAN_CATS ++#undef MAN_CATS + + /* By default, man-db will store a whatis referenced manual page in favour + of a stray cat page when they both share identical namespace. If you +@@ -136,7 +136,7 @@ - #ifndef TR -@@ -134,6 +134,8 @@ #ifndef NROFF_MISSING # ifndef NROFF - # define NROFF "@nroff@" -+# undef NROFF -+# define NROFF "/usr/bin/nroff -mandocdb" +-# define NROFF "@nroff@" ++# define NROFF "nroff -mandocdb" # endif #endif -@@ -238,8 +240,12 @@ +@@ -240,8 +240,12 @@ #ifdef inline /* autoconf #defines inline to be either "__inline", "__inline__" or "" if the compiler doesn't like inline */ @@ -368,28 +234,8 @@ #endif /* inline */ /* my gcc specs file is hacked to define __profile__ if I compile with -@@ -307,14 +313,17 @@ extern struct compression *comp_file (co - extern char *decompress (const char *filename, const struct compression *comp); - extern __inline__ void remove_ztemp (void); - extern __inline__ char *get_ztemp (void); -+extern __inline__ void set_wbuf(const char* whatis); -+extern __inline__ char *get_wbuf(void); -+ - - /* straycats.c */ - extern int straycats (char *mandir); - - /* lexgrog.l */ - struct lexgrog; --extern int find_name (const char *file, const char *filename, -- struct lexgrog *p_lg); -+extern int find_name (const char *file, const char *filename, struct lexgrog *p_lg); -+extern int find_name_str(char *buffer, const char *filename, struct lexgrog *p_lg); - - /* util.c */ - struct pipeline; -@@ -327,11 +336,17 @@ extern int remove_directory (const char - extern char *trim_spaces (const char *s); +@@ -385,11 +389,17 @@ extern char *trim_spaces (const char *s) + extern char *lang_dir (const char *filename); #ifndef HAVE_BASENAME -extern char *basename (); @@ -407,7 +253,7 @@ #endif /* !HAVE_STRSEP */ #ifndef HAVE_GETCWD -@@ -356,7 +371,6 @@ extern char *program_name; /* the basena +@@ -414,12 +424,13 @@ extern char *program_name; /* the basena #define FAIL 1 /* usage or syntax error */ #define FATAL 2 /* operational error */ #define CHILD_FAIL 3 /* child failed */ @@ -415,9 +261,16 @@ #define NOT_FOUND 16 /* No action was taken */ /* System or user catpaths? Allow bitwise disjunctions of these. */ + #define SYSTEM_CAT 1 + #define USER_CAT 2 ++#define FILE_CAT 4 ++#define WHATIS_CAT 8 + + /* string macros */ + #define STREQ(a,b) (strcmp(a,b) == 0) --- intl/Makefile.in -+++ intl/Makefile.in 2007-02-15 00:00:00.000000000 +0100 -@@ -133,7 +133,7 @@ COPYING.LIB-2 gettext.h libgettext.h plu ++++ intl/Makefile.in 2007-12-10 12:51:50.562101000 +0100 +@@ -177,7 +177,7 @@ libgnuintl.h.msvc-shared Makefile.msvc all: all-@USE_INCLUDED_LIBINTL@ all-yes: libintl.$la libintl.h charset.alias ref-add.sed ref-del.sed @@ -427,7 +280,7 @@ all-no-no: --- lib/basename.c -+++ lib/basename.c 2007-02-15 00:00:00.000000000 +0100 ++++ lib/basename.c 2007-12-10 12:51:50.598106000 +0100 @@ -37,11 +37,13 @@ extern char *strrchr(); #endif /* STDC_HEADERS */ @@ -444,21 +297,21 @@ } +#endif --- lib/cleanup.c -+++ lib/cleanup.c 2007-02-15 00:00:00.000000000 +0100 -@@ -101,7 +101,7 @@ trap_signal (int signo, struct sigaction ++++ lib/cleanup.c 2007-12-10 13:07:01.233682000 +0100 +@@ -102,7 +102,7 @@ trap_signal (int signo, struct sigaction act.sa_handler = sighandler; sigemptyset (&act.sa_mask); - act.sa_flags = 0; + act.sa_flags = SA_ONESHOT; - return sigaction (signo, &act, oldact); + return xsigaction (signo, &act, oldact); } --- lib/xmalloc.c -+++ lib/xmalloc.c 2007-02-15 00:00:00.000000000 +0100 -@@ -43,6 +43,8 @@ extern void error (int, int, const char - extern void error (); - #endif ++++ lib/xmalloc.c 2007-12-10 12:51:50.666114000 +0100 +@@ -39,6 +39,8 @@ void free (); + The caller may set it to some other value. */ + int xmalloc_exit_failure = EXIT_FAILURE; +#include "manconfig.h" + @@ -466,53 +319,95 @@ fixup_null_alloc (size_t n) { --- libdb/Makefile.in -+++ libdb/Makefile.in 2007-02-15 00:00:00.000000000 +0100 -@@ -34,10 +34,7 @@ include $(top_srcdir)/include/Defines - .PHONY: $(DEFAULT_TARGETS) ++++ libdb/Makefile.in 2007-12-10 13:08:09.382330000 +0100 +@@ -35,9 +35,6 @@ include $(top_srcdir)/include/Defines MANDEFS = --MANCPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir) -I$(srcdir) -I- + MANCPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir) -I$(srcdir) -ifeq ($(USE_NLS),yes) -MANCPPFLAGS += -I$(top_srcdir)/intl -endif -+MANCPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir) -I$(srcdir) # The default programs to build ALL = db_store.o db_delete.o db_lookup.o \ --- libdb/mydbm.h -+++ libdb/mydbm.h 2007-02-15 00:00:00.000000000 +0100 -@@ -144,7 +144,7 @@ extern __inline__ int btree_nextkeydata( - # define DB_EXT ".bt" - # define MYDBM_FILE DB* ++++ libdb/mydbm.h 2007-12-10 12:51:50.738124000 +0100 +@@ -150,7 +150,7 @@ extern __inline__ int btree_nextkeydata( + # define MYDBM_SET_DPTR(d, value) ((d).data = (char *) (value)) + # define MYDBM_DSIZE(d) ((d).size) # define MYDBM_CTRWOPEN(file) btree_flopen(file, O_TRUNC|O_CREAT|O_RDWR, DBMODE) -# define MYDBM_CRWOPEN(file) btree_flopen(file, O_CREAT|O_RDWR, DBMODE) +# define MYDBM_CRWOPEN(file) btree_flopen(file, O_CREAT|O_RDWR, DBMODE) # define MYDBM_RWOPEN(file) btree_flopen(file, O_RDWR, DBMODE) # define MYDBM_RDOPEN(file) btree_flopen(file, O_RDONLY, DBMODE) - # define MYDBM_INSERT(dbf, key, cont) btree_insert(dbf, key, cont) ---- man/de_DE.88591/man1/man.man1 -+++ man/de_DE.88591/man1/man.man1 2007-02-15 00:00:00.000000000 +0100 + # define MYDBM_INSERT(db, key, cont) btree_insert(db, key, cont) +--- man/Makefile.in ++++ man/Makefile.in 2007-12-11 13:10:03.780541000 +0100 +@@ -85,17 +85,17 @@ man8files = $(addprefix $(path)/man8/, $ + allmanpages := $(foreach file, $(foreach path, . $(NLS), $(man1files) $(man5files) $(man8files)), $(subst .man,.,$(wildcard $(file)))) + + # NB manpath.5 is not expanded +-man.1 = $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir)/$(man)$(man1ext) +-manpath.1 = $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir)/$(manpath)$(man1ext) +-apropos.1 = $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir)/$(apropos)$(man1ext) +-whatis.1 = $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir)/$(whatis)$(man1ext) +-zsoelim.1 = $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir)/$(zsoelim)$(man1ext) +-lexgrog.1 = $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir)/lexgrog$(man1ext) +-manconv.1 = $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir)/$(manconv)$(man1ext) +-manpath.5 = $(DESTDIR)$(manroot)/$(nlspath)/$(man5dir)/manpath$(man5ext) +-mandb.8 = $(DESTDIR)$(manroot)/$(nlspath)/$(man8dir)/$(mandb)$(man8ext) +-catman.8 = $(DESTDIR)$(manroot)/$(nlspath)/$(man8dir)/$(catman)$(man8ext) +-accessdb.8 = $(DESTDIR)$(manroot)/$(nlspath)/$(man8dir)/accessdb$(man8ext) ++man.1 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir)/$(man)$(man1ext) ++manpath.1 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir)/$(manpath)$(man1ext) ++apropos.1 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir)/$(apropos)$(man1ext) ++whatis.1 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir)/$(whatis)$(man1ext) ++zsoelim.1 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir)/$(zsoelim)$(man1ext) ++lexgrog.1 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir)/lexgrog$(man1ext) ++manconv.1 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir)/$(manconv)$(man1ext) ++manpath.5 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man5dir)/manpath$(man5ext) ++mandb.8 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man8dir)/$(mandb)$(man8ext) ++catman.8 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man8dir)/$(catman)$(man8ext) ++accessdb.8 = $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man8dir)/accessdb$(man8ext) + + # Rules... We've got some rules 'round here. + %.1: %.man1 +@@ -119,9 +119,9 @@ endif + + # special targets + nlsinstall: +- $(MKINSTALLDIRS) $(DESTDIR)$(manroot)/$(nlspath)/$(man1dir) +- $(MKINSTALLDIRS) $(DESTDIR)$(manroot)/$(nlspath)/$(man5dir) +- $(MKINSTALLDIRS) $(DESTDIR)$(manroot)/$(nlspath)/$(man8dir) ++ $(MKINSTALLDIRS) $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man1dir) ++ $(MKINSTALLDIRS) $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man5dir) ++ $(MKINSTALLDIRS) $(DESTDIR)$(manroot)/$(basename $(nlspath))/$(man8dir) + $(INSTALL_DATA) $(nlspath)/man1/man.1 $(man.1) + $(INSTALL_DATA) $(nlspath)/man1/manpath.1 $(manpath.1) + $(INSTALL_DATA) $(nlspath)/man1/apropos.1 $(apropos.1) +--- man/de.UTF-8/man1/man.man1 ++++ man/de.UTF-8/man1/man.man1 2007-12-11 12:28:04.213373000 +0100 @@ -98,6 +98,7 @@ der Manualseiten gefolgt vom Typ der dor .TS tab (@); l l. -+0@Dateiheader (gew鐬nlich in \fI/usr/include\fR) - 1@Ausfhrbare Programme oder Shellbefehle ++0@Dateiheader (gew繹hnlich in \fI/usr/include\fR) + 1@Ausf羹hrbare Programme oder Shellbefehle 2@Systemaufrufe (Kernelfunktionen) 3@Bibliotheksaufrufe (Funktionen in System-Bibliotheken) ---- man/es_ES.88591/man1/man.man1 -+++ man/es_ES.88591/man1/man.man1 2007-02-15 00:00:00.000000000 +0100 -@@ -101,6 +101,7 @@ del manual y los tipos de p墔inas que co +--- man/es.UTF-8/man1/man.man1 ++++ man/es.UTF-8/man1/man.man1 2007-12-10 13:11:03.360408000 +0100 +@@ -101,6 +101,7 @@ del manual y los tipos de p獺ginas que c .TS tab (@); l l. +0@Ficheros (se encuentran generalmente en \fI/usr/include\fR) - 1@Programas ejecutables y guiones del int廨prete de - @鏎denes - 2@Llamadas del sistema (funciones servidas por el ncleo) ---- man/it_IT.88591/man1/man.man1 -+++ man/it_IT.88591/man1/man.man1 2007-02-15 00:00:00.000000000 +0100 -@@ -104,6 +104,7 @@ del manuale seguiti dai tipi di pagine c + 1@Programas ejecutables y guiones del int矇rprete de + @籀rdenes + 2@Llamadas del sistema (funciones servidas por el n繳cleo) +--- man/it.UTF-8/man1/man.man1 ++++ man/it.UTF-8/man1/man.man1 2007-12-10 12:53:23.697923000 +0100 +@@ -124,6 +124,7 @@ del manuale seguiti dai tipi di pagine c .TS tab (@); l l. @@ -520,19 +415,19 @@ 1@Programmi eseguibili e comandi della shell 2@Chiamate al sistema (funzioni fornite dal kernel) 3@Chiamate alle librerie (funzioni all'interno delle ---- man/ja_JP.eucJP/man1/man.man1 -+++ man/ja_JP.eucJP/man1/man.man1 2007-02-15 00:00:00.000000000 +0100 +--- man/ja.UTF-8/man1/man.man1 ++++ man/ja.UTF-8/man1/man.man1 2007-12-10 13:11:42.941431000 +0100 @@ -104,6 +104,7 @@ .TS tab (@); l l. +0@ - 1@撢墊皿伕弘仿丞引凶反扑尼伙及戊穴件玉 - 2@扑旦氾丞戊□伙 (市□生伙互羼間允月楮醒) - 3@仿奶皮仿伉戊□伙 (扑旦氾丞仿奶皮仿伉卞殖引木月楮醒) + 1@摰銵准啜押整胯瑯扼怒柴喋喋 + 2@瑯嫘喋潦 (怒潦怒靘X) + 3@押扎押芥喋潦 (瑯嫘押扎押芥怠怒整X) --- man/man1/man.man1 -+++ man/man1/man.man1 2007-02-15 00:00:00.000000000 +0100 -@@ -110,6 +110,7 @@ numbers of the manual followed by the ty ++++ man/man1/man.man1 2007-12-10 12:53:31.282886000 +0100 +@@ -114,6 +114,7 @@ numbers of the manual followed by the ty .TS tab (@); l l. @@ -541,26 +436,26 @@ 2@System calls (functions provided by the kernel) 3@Library calls (functions within program libraries) --- src/Makefile.in -+++ src/Makefile.in 2007-02-15 00:00:00.000000000 +0100 ++++ src/Makefile.in 2007-12-10 13:13:47.713263000 +0100 @@ -40,7 +40,7 @@ include ../include/Defines MANDEFS = -DCONFIG_FILE=\"$(config_file)\" \ -DLOCALEDIR=\"$(gnulocaledir)\" $(DEFS_$(subst /,_,$@)) --MANCPPFLAGS = -I../include -I$(top_srcdir) -I$(srcdir) -I- -I../intl +-MANCPPFLAGS = -I../include -I$(top_srcdir) -I$(srcdir) -I../intl +MANCPPFLAGS = -I../include -I$(top_srcdir) -I$(srcdir) -I. #----------------------------------------------------------------# # user changeable definitions can be found in ../include/Defines # -@@ -117,7 +117,7 @@ apropos: whatis.c - +@@ -123,7 +123,7 @@ apropos: whatis.c # Rules to test code as program unit - lexgrog: lexgrog.c compression.o fake_security.o ult_src.o util.o + lexgrog: lexgrog.c compression.o descriptions.o encodings.o fake_security.o \ + ult_src.o util.o - $(LINK.c) -DTEST $^ $(LDLIBS) -o $@ + $(LINK.c) -g -DTEST $^ $(LDLIBS) -o $@ globbing: globbing.c util.o $(LINK.c) -DTEST $^ $(LDLIBS) -o $@ -@@ -126,8 +126,10 @@ globbing: globbing.c util.o +@@ -132,8 +132,10 @@ globbing: globbing.c util.o install: $(MKINSTALLDIRS) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) \ $(DESTDIR)$(libdir)/man-db @@ -574,86 +469,8 @@ $(INSTALL_PROGRAM) catman $(DESTDIR)$(bindir)/$(catman) $(INSTALL_PROGRAM) whatis $(DESTDIR)$(bindir)/$(whatis) --- src/check_mandirs.c -+++ src/check_mandirs.c 2007-02-15 00:00:00.000000000 +0100 -@@ -161,7 +161,7 @@ void test_manfile (const char *file, con - } - - /* see if we already have it, before going any further, this will -- save both an ult_src() a find_name(), amongst other time wastes */ -+ save both an ult_src() a find_name()/find_name_str(), amongst other time wastes */ - exists = dblookup_exact (base_name, info.ext, 1); - - /* Ensure we really have the actual page. Gzip keeps the mtime -@@ -236,13 +236,20 @@ void test_manfile (const char *file, con - '.so manx/foo.x', which will give us an unobtainable - whatis for the entry. */ - ult = ult_src (file, path, &buf, -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ SO_LINK | SOFT_LINK | HARD_LINK | WHATISBUF); -+#else /* !COMP_SRC || !HAVE_ZIO */ - SO_LINK | SOFT_LINK | HARD_LINK); -+#endif /* !COMP_SRC || !HAVE_ZIO */ - } - - if (!ult) { - error (0, 0, - _("warning: %s: bad symlink or ROFF `.so' request"), - file); -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ set_wbuf(NULL); /* get rid of temp buffer */ -+#endif /* COMP_SRC && HAVE_ZIO */ - free (manpage); - return; - } -@@ -256,7 +263,7 @@ void test_manfile (const char *file, con - - /* Ok, here goes: Use a hash tree to store the ult_srcs with - * their whatis. Anytime after, check the hash tree, if it's there, -- * use it. This saves us a find_name() which is a real hog. -+ * use it. This saves us a find_name()/find_name_str() which is a real hog. - * - * Use the full path in ult as the hash key so we don't have to - * clear the hash between calls. -@@ -268,21 +275,38 @@ void test_manfile (const char *file, con - /* go get the whatis info in its raw state */ - char *file_copy = xstrdup (file); - #ifdef COMP_SRC -+# ifdef HAVE_ZIO -+ /* if the nroff was compressed, an uncompressed copy is -+ shown by a call to get_wbuf(), grog this for a whatis -+ rather than ult. This is a bit difficult to follow, sorry: -+ ult_src() will leave a buffer with the head of the last -+ uncompressed nroff file it has to deal with in get_wbuf() */ -+# else - /* if the nroff was compressed, an uncompressed version is - shown by a call to get_ztemp(), grog this for a whatis - rather than ult. This is a bit difficult to follow, sorry: - ult_src() will leave the last uncompressed nroff file it - has to deal with in get_ztemp() */ -+# endif - char *ztemp; - #endif /* COMP_SRC */ - - lg.type = MANPAGE; - drop_effective_privs (); - #ifdef COMP_SRC -+# ifdef HAVE_ZIO -+ ztemp = get_wbuf (); -+# else - ztemp = get_ztemp (); -+# endif - if (ztemp) { -+# ifdef HAVE_ZIO -+ find_name_str (ztemp, basename ((char*)file), &lg); -+ set_wbuf(NULL); /* get rid of temp file identifier */ -+# else - find_name (ztemp, basename (file_copy), &lg); - remove_ztemp (); /* get rid of temp file identifier */ -+# endif - } else - #endif /* COMP_SRC */ - find_name (ult, basename (file_copy), &lg); -@@ -415,10 +439,10 @@ static short testmandirs (const char *pa ++++ src/check_mandirs.c 2007-12-10 13:15:48.608604000 +0100 +@@ -391,10 +391,10 @@ static short testmandirs (const char *pa } if (!quiet) { @@ -665,25 +482,25 @@ } add_dir_entries (path, mandir->d_name); MYDBM_CLOSE (dbf); -@@ -576,7 +600,7 @@ short update_db (const char *manpath) +@@ -590,7 +590,7 @@ short update_db (const char *manpath) + return new; } - if (debug) -- fprintf (stderr, "failed to open %s O_RDONLY\n", database); -+ fprintf (stderr, "failed to open database %s O_RDONLY\n", database); +- debug ("failed to open %s O_RDONLY\n", database); ++ debug ("failed to open database %s O_RDONLY\n", database); return EOF; } -@@ -762,6 +786,7 @@ static short purge_whatis (const char *p - name, info->ext); +@@ -766,6 +766,7 @@ static short purge_whatis (const char *p + "would delete\n", name, info->ext); return 1; } + return 1; } /* Check that multi keys are correctly constructed. */ -@@ -822,6 +847,11 @@ short purge_missing (const char *manpath - gripe_rwopen_failed (database); +@@ -828,6 +829,11 @@ short purge_missing (const char *manpath + gripe_rwopen_failed (); return 0; } + if (dbver_rd (dbf)) { @@ -694,7 +511,7 @@ key = MYDBM_FIRSTKEY (dbf); -@@ -840,6 +870,14 @@ short purge_missing (const char *manpath +@@ -846,6 +852,14 @@ short purge_missing (const char *manpath continue; } @@ -707,85 +524,10 @@ + } + content = MYDBM_FETCH (dbf, key); - if (!content.dptr) + if (!MYDBM_DPTR (content)) return count; ---- src/compression.c -+++ src/compression.c 2007-02-15 00:00:00.000000000 +0100 -@@ -60,26 +60,30 @@ extern int errno; - #ifdef COMP_SRC /* must come after manconfig.h */ - - #include "lib/error.h" -+#include "lib/cleanup.h" - #include "lib/pipeline.h" - #include "security.h" - #include "comp_src.h" - - static char *file; /* pointer to temp file name */ - static int file_fd = -1; -+static char *wbuf = NULL; /* temporary buffer for the whatis scan */ - -+#ifndef HAVE_ZIO - /* initialise temp filename */ - static __inline__ void create_ztemp (void) - { - int oldmask = umask (022); - drop_effective_privs (); - file_fd = create_tempfile ("zman", &file); -+ regain_effective_privs (); - - if (file_fd < 0) - error (FATAL, errno, _("can't create a temporary filename")); -- regain_effective_privs (); -- umask (oldmask); -- atexit (remove_ztemp); -+ (void) umask (oldmask); -+ push_cleanup ((void (*)())remove_ztemp, NULL); - } -+#endif - - /* Take filename as arg, return structure containing decompressor - and extension, or NULL if no comp extension found. -@@ -152,6 +156,7 @@ struct compression *comp_file (const cha - return NULL; - } - -+#ifndef HAVE_ZIO - /* Set up a pointer to a unique temp filename on first call. - * If this returns NULL, an error message will have been printed and the - * caller should abort the current operation as appropriate. -@@ -215,6 +220,7 @@ void remove_ztemp (void) - (void) remove_with_dropped_privs (file); - free (file); - file = NULL; -+ pop_cleanup(); - } - } - -@@ -223,4 +229,22 @@ char *get_ztemp (void) - { - return file; - } -+#endif -+ -+/* remember temporary the head of an nroff buffer */ -+void set_wbuf(const char* whatis) -+{ -+ if (wbuf) -+ free(wbuf); -+ wbuf = NULL; -+ if (whatis) -+ wbuf = xstrdup(whatis); -+} -+ -+/* return temporary buffer for whatis */ -+char *get_wbuf(void) -+{ -+ return wbuf; -+} -+ - #endif /* COMP_SRC */ --- src/fake_security.c -+++ src/fake_security.c 2007-02-15 00:00:00.000000000 +0100 ++++ src/fake_security.c 2007-12-10 12:53:31.362896000 +0100 @@ -45,6 +45,7 @@ extern int errno; #include "security.h" @@ -795,20 +537,9 @@ #ifdef SECURE_MAN_UID static struct passwd *man_owner; --- src/lexgrog.l -+++ src/lexgrog.l 2007-02-15 00:00:00.000000000 +0100 -@@ -45,6 +45,10 @@ extern int errno; - # include - #endif /* HAVE_UNISTD_H */ - -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+# include -+#endif /* COMP_SRC && HAVE_ZIO */ -+ - #ifdef HAVE_STRING_H - # include - #elif defined (HAVE_STRINGS_H) -@@ -64,7 +68,7 @@ extern int errno; - #include "security.h" ++++ src/lexgrog.l 2007-12-10 16:36:13.786133000 +0100 +@@ -67,7 +67,7 @@ extern int errno; + #include "encodings.h" #include "ult_src.h" -#define YY_READ_BUF_SIZE 1024 @@ -816,7 +547,7 @@ #define MAX_NAME 2048 #ifdef PROFILE -@@ -72,10 +76,10 @@ static int ctr[YY_NUM_RULES]; +@@ -75,10 +75,10 @@ static int ctr[YY_NUM_RULES]; # define YY_USER_ACTION ++ctr[yy_act]; #endif @@ -831,15 +562,15 @@ static char newname[MAX_NAME]; static char *p_name; -@@ -84,6 +88,7 @@ static char filters[MAX_FILTERS]; +@@ -87,6 +87,7 @@ static char filters[MAX_FILTERS]; static int fill_mode; static int waiting_for_quote; +static int have_separator; - #ifdef TEST + static pipeline *decomp; -@@ -114,7 +119,7 @@ static const char args[] = "mcwfhV"; +@@ -131,7 +132,7 @@ static const char args[] = "mcwfE:hV"; %} %option ecs meta-ecs @@ -848,7 +579,7 @@ %option nostdinit %option warn %option noyywrap nounput -@@ -143,8 +148,9 @@ font_change \\f([[:upper:]1-4]|\({upper} +@@ -160,8 +161,9 @@ font_change \\f([[:upper:]1-4]|\({upper} size_change \\s[+-]?{digit} style_change ({font_change}{size_change}?|{size_change}{font_change}?) typeface \.(B[IR]?|I[BR]?|R[BI]) @@ -858,11 +589,11 @@ +comment (['.]\\{dbl_quote}|\'\-+|\\&) /* Please add to this list if you know how. */ - cs_name J[Mm][扙Ee][Nn][Oo] -@@ -162,7 +168,26 @@ nl_name N[Aa][Aa][Mm] - pl_name N[Aa][Zz][Ww][Aa] - sv_name N[Aa][Mm][Nn] - name ({cs_name}|{de_name}|{en_name}|{es_name}|{fi_name}|{fr_name}|{hu_name}|{it_name}|{ja_name}|{latin_name}|{nl_name}|{pl_name}|{sv_name}) + /* Note that, since flex only supports UTF-8 by accident, character classes +@@ -194,7 +196,26 @@ vi_name TN + zh_CN_name {blank}?蝘閃blank}?.* + zh_TW_name ({blank}?蝔悴賭誘){blank}?.* + name ({bg_name}|{cs_name}|{da_name}|{de_name}|{en_name}|{es_name}|{fi_name}|{fr_name}|{hu_name}|{id_name}|{it_name}|{ja_name}|{ko_name}|{latin_name}|{nl_name}|{pl_name}|{ru_name}|{sk_name}|{sr_name}|{sv_name}|{tr_name}|{vi_name}|{zh_CN_name}|{zh_TW_name}) -name_sec {dbl_quote}?{style_change}?{name}{style_change}?({blank}*{dbl_quote})? +name_sec {dbl_quote}?{style_change}?{name}{style_change}?({blank}*{dbl_quote})?\r? +start {sec_request}{blank_eol}+{name_sec} @@ -883,11 +614,11 @@ +u (U(\bU)?|u(\bu)?) +g (G(\bG)?|g(\bg)?) + -+cname (({N}({a}|{o}){m}({n}|{e})|{N}{o}{m}|{N}{o}{m}{b}{r}{e}|{B}{e}{z}{e}{i}{c}{h}{n}{u}{n}{g})|{ja_name}) ++cname (({N}({a}|{o}){m}({n}|{e})|{N}{o}{m}|{N}{o}{m}{b}{r}{e}|{B}{e}{z}{e}{i}{c}{h}{n}{u}{n}{g})|{bg_name}|{cs_name}|{hu_name}|{ko_name}|{ru_name}|{sr_name}|{tr_name}|{vi_name}|{ja_name}|{zh_CN_name}|{zh_TW_name}) /* eptgrv : eqn, pic, tbl, grap, refer, vgrind */ tbl_request \.TS -@@ -176,8 +201,13 @@ vgrind_request \.vS +@@ -208,8 +229,13 @@ vgrind_request \.vS %% /* begin NAME section processing */ @@ -903,7 +634,7 @@ /* general text matching */ \.[^Ss\r\n].* | -@@ -228,6 +258,7 @@ vgrind_request \.vS +@@ -260,6 +286,7 @@ vgrind_request \.vS {bol}\.sp{blank}* | /* vertical spacing */ {bol}\.ig{blank}* | /* block comment */ {bol}\.de[1i]?{blank}* | /* macro definition */ @@ -911,10 +642,10 @@ {empty}{bol}.+ | <> { /* terminate the string */ *p_name = '\0'; -@@ -251,28 +282,31 @@ vgrind_request \.vS - } - +@@ -285,28 +312,31 @@ vgrind_request \.vS {bol}{typeface}{blank}+ | /* type face commands */ + {bol}\.ft{blank}.* | /* font change */ + {bol}\.V[be]{blank}.* | /* pod2man, verbatim mode */ - {bol}\.IX{blank}.* | /* .IX line */ + {bol}\.IX{blank}.* | /* index request */ {next}{comment}.* { /* per line comments */ @@ -928,10 +659,9 @@ +{bol}\.{blank}*/{eol} newline_found (); +{bol}\.\./{eol} newline_found (); -- /* Toggle fill mode */ + /* Toggle fill mode */ -{bol}\.nf.* fill_mode = 0; -{bol}\.fi.* fill_mode = 1; -+ /* Toggle fill mode, also for roff macro definitions */ +{bol}\.(nf|de).* fill_mode = 0; +{bol}\.(fi|\.).* fill_mode = 1; @@ -950,7 +680,7 @@ /* escape sequences and special characters */ { -@@ -288,6 +322,7 @@ vgrind_request \.vS +@@ -322,6 +352,7 @@ vgrind_request \.vS {next}\\[|^&!%acdpruz{}\r\n] /* various useless control chars */ {next}\\[bhlLvx]{blank}*'[^']+' /* various inline functions */ @@ -958,17 +688,20 @@ {next}\\\$[1-9] /* interpolate arg */ {next}\\\*(\({alpha})?{alpha} /* interpolate string */ -@@ -316,8 +351,7 @@ vgrind_request \.vS +@@ -350,11 +381,8 @@ vgrind_request \.vS for later processing */ { {bol}\.br{blank}* | - {bol}\.LP{blank}* | - {bol}\.PP{blank}* | + {bol}{paragr}{blank}* | - {bol}\.P{blank}* add_char_to_whatis ((char) 0x11); + {bol}\.P{blank}* | +- {bol}\.IP{blank}.* | +- {bol}\.HP{blank}.* | + {bol}\.RS{blank}.* | + {bol}\.RE{blank}.* add_char_to_whatis ((char) 0x11); } - -@@ -329,7 +363,7 @@ vgrind_request \.vS +@@ -367,7 +395,7 @@ vgrind_request \.vS [[:alnum:]]* add_str_to_whatis (yytext, yyleng); /* normalise the period (,) separators */ @@ -977,7 +710,7 @@ {blank}*,{blank}* add_str_to_whatis (", ", 2); {bol}. { -@@ -345,7 +379,7 @@ vgrind_request \.vS +@@ -383,7 +411,7 @@ vgrind_request \.vS %% /* print warning and force scanner to terminate */ @@ -986,7 +719,7 @@ { error (0, 0, _("warning: whatis for %s exceeds %d bytes, truncating."), -@@ -355,7 +389,7 @@ static void too_big (void) +@@ -393,7 +421,7 @@ static void too_big (void) } /* append a string to newname if enough room */ @@ -995,7 +728,7 @@ { if (p_name - newname + length >= MAX_NAME) too_big (); -@@ -366,8 +400,10 @@ static void add_str_to_whatis (const cha +@@ -404,8 +432,10 @@ static void add_str_to_whatis (const cha } /* append a char to newname if enough room */ @@ -1007,7 +740,7 @@ if (p_name - newname + 1 >= MAX_NAME) too_big (); else if (waiting_for_quote && c == '"') -@@ -379,14 +415,30 @@ static void add_char_to_whatis (unsigned +@@ -417,14 +447,30 @@ static void add_char_to_whatis (unsigned /* append the " - " separator to newname, trimming the first space if one's * already there */ @@ -1040,45 +773,7 @@ { /* If we are mid p_name and the last added char was not a space, * best add one. -@@ -423,6 +475,10 @@ int find_name (const char *file, const c - } - - #ifdef COMP_SRC -+# ifdef HAVE_ZIO -+ /* See if we need to use fzopen(). */ -+ comp = comp_info (file, 0); -+# else - /* See if we need to decompress the file(s) first. */ - comp = comp_info (file, 0); - if (comp) { -@@ -430,18 +486,25 @@ int find_name (const char *file, const c - if (!file) - return 0; - } -+# endif - #endif /* COMP_SRC */ - drop_effective_privs (); -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ if (comp) -+ yyin = fzopen (file, "r"); -+ else -+#endif - yyin = fopen (file, "r"); - regain_effective_privs (); - if (!yyin) { - error (0, errno, _("can't open %s"), file); --#ifdef COMP_SRC -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - remove_ztemp (); - #endif /* COMP_SRC */ - return 0; - } - } -+ setvbuf(yyin, NULL, _IOFBF, YY_READ_BUF_SIZE); - - fname = filename; - *(p_name = newname) = '\0'; -@@ -449,6 +512,7 @@ int find_name (const char *file, const c +@@ -500,6 +546,7 @@ int find_name_decompressed (pipeline *p, fill_mode = 1; waiting_for_quote = 0; @@ -1086,112 +781,9 @@ if (p_lg->type) BEGIN (CAT_FILE); -@@ -461,7 +525,7 @@ int find_name (const char *file, const c - ret = yylex (); - fclose (yyin); - --#ifdef COMP_SRC -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - remove_ztemp (); - #endif - -@@ -493,6 +557,58 @@ int find_name (const char *file, const c - } - } - -+int find_name_str(char *buffer, const char *filename, lexgrog *p_lg) -+{ -+ int i; -+ -+ if (!buffer || (i = strlen(buffer)) < 14) -+ return 0; -+ -+ fname = filename; -+ *(p_name = newname) = '\0'; -+ memset(filters, '_', sizeof(filters)); -+ -+ fill_mode = 1; -+ waiting_for_quote = 0; -+ have_separator = 0; -+ -+ if (p_lg->type) -+ BEGIN(CAT_FILE); -+ else -+ BEGIN(MAN_FILE); -+ -+ buffer[i-1] = buffer[i-2] = YY_END_OF_BUFFER_CHAR; -+ -+ yy_switch_to_buffer(yy_scan_buffer(buffer, i)); -+ i = yylex(); -+ yy_delete_buffer(YY_CURRENT_BUFFER); -+ -+ if (i) -+ return 0; -+ else { -+ char f_tmp[MAX_FILTERS]; -+ int j, k; -+ -+ /* wipe out any leading or trailing spaces */ -+ if (*newname) { -+ for (p_name = strchr (newname, '\0'); -+ *(p_name - 1) == ' '; -+ p_name--); -+ if (*p_name == ' ') -+ *p_name = '\0'; -+ } -+ for (p_name = newname; *p_name == ' '; p_name++); -+ p_lg->whatis = xstrdup (p_name); -+ memset(f_tmp, '\0', MAX_FILTERS); -+ f_tmp[0] = '-'; -+ for (j = k = 0; j < MAX_FILTERS; j++ ) -+ if (filters[j] != '_' ) -+ f_tmp[k++] = filters[j]; -+ p_lg->filters = xstrdup (f_tmp); -+ return p_name[0]; -+ } -+} -+ - #ifdef TEST - - static void usage (int status) -@@ -595,7 +711,7 @@ int main (int argc, char **argv) - &statbuf, SO_LINK); - if (path) - free (path); --#ifdef COMP_SRC -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - if (file) { - char *ztemp = get_ztemp (); - if (ztemp) -@@ -617,7 +733,24 @@ int main (int argc, char **argv) - } - ++optind; - } -- -+#if 0 -+ printf("Tests with strings instead of files\n\n"); -+ { -+ int type; -+ for (type = 0; type <= 1; type++) { -+ lexgrog lg; -+ lg.type = type; -+ if (lg.type == MANPAGE) { -+ printf("man: \"%d %s\"\n", find_name_str(xstrdup(".SH NAME\nman \\- String1\n.SH"), "-", &lg), lg.whatis); -+ printf("man: \"%d %s\"\n", find_name_str(xstrdup(".SH NAME\nman \\- String2\n.SH"), "-", &lg), lg.whatis); -+ } -+ if (lg.type == CATPAGE) { -+ printf("cat: \"%d %s\"\n", find_name_str(xstrdup("\n\nNAME\n cat - String1\n\nD"), "-", &lg), lg.whatis); -+ printf("cat: \"%d %s\"\n", find_name_str(xstrdup("\n\nNAME\n cat - String2\n\nD"), "-", &lg), lg.whatis); -+ } -+ } -+ } -+#endif - if (some_failed) - return FATAL; - else --- src/man.c -+++ src/man.c 2007-02-15 00:00:00.000000000 +0100 -@@ -98,11 +98,16 @@ static char *cwd; ++++ src/man.c 2007-12-11 17:18:15.773649394 +0100 +@@ -98,6 +98,7 @@ static char *cwd; #include #include #include @@ -1199,16 +791,7 @@ #if HAVE_SYS_WAIT_H # include - #endif - -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+# include -+#endif -+ - #ifndef STDC_HEADERS - extern char *getenv(); - extern int errno; -@@ -144,6 +149,8 @@ extern int errno; +@@ -147,6 +148,8 @@ extern int errno; #ifdef SECURE_MAN_UID extern uid_t ruid; extern uid_t euid; @@ -1216,8 +799,8 @@ +extern gid_t egid; #endif /* SECURE_MAN_UID */ - /* the magic cookie to request preprocessing */ -@@ -177,6 +184,10 @@ const char *lang; + /* the default preprocessor sequence */ +@@ -177,6 +180,10 @@ const char *lang; static int global_manpath = -1; /* global or user manual page hierarchy? */ static int skip; /* page exists but has been skipped */ @@ -1228,7 +811,16 @@ #if defined _AIX || defined __sgi char **global_argv; -@@ -372,9 +383,9 @@ static const struct option long_options[ +@@ -249,7 +256,7 @@ static char *tmp_cat_file; /* for open_c + static int tmp_cat_fd; + static int created_tmp_cat; /* dto. */ + static int man_modtime; /* modtime of man page, for commit_tmp_cat() */ +-#endif ++#endif /* MAN_CATS */ + + static const struct option long_options[] = + { +@@ -295,9 +302,9 @@ static const struct option long_options[ static const char args[] = "7DlM:P:S:adfhH::kVum:p:tT::wWe:L:Zcr:X::E:iIC:"; # ifdef TROFF_IS_GROFF @@ -1240,7 +832,7 @@ static const char *html_pager; # endif /* TROFF_IS_GROFF */ -@@ -475,26 +486,6 @@ static void gripe_no_name (const char *s +@@ -400,25 +407,6 @@ static void gripe_no_name (const char *s exit (FAIL); } @@ -1256,18 +848,17 @@ -static void get_term (void) -{ - if (isatty (fileno (stdout))) { -- if (debug) -- fprintf(stderr, "is a tty\n"); +- debug ("is a tty\n"); - tcgetattr (fileno (stdin), &tms); - if (!tms_set++) - atexit (set_term); - } -} - - /* Line length detection code adapted from Andries Brouwer's man. */ - - /* Try to determine the line length to use. -@@ -637,11 +628,11 @@ static __inline__ char **manopt_to_env ( + static int get_roff_line_length (void) + { + int line_length = get_line_length (); +@@ -503,11 +491,11 @@ static __inline__ char **manopt_to_env ( { char *manopt, *opt_start, **argv; @@ -1281,33 +872,27 @@ /* allocate space for the program name */ *argc = 0; -@@ -758,43 +749,56 @@ static int local_man_loop (const char *a +@@ -624,36 +612,51 @@ static int local_man_loop (const char *a display (NULL, "", NULL, "(stdin)", NULL); else { struct stat st; --#ifdef COMP_SRC -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - struct compression *comp; - #endif /* COMP_SRC */ + char *pwd = cwd; + char *file = basename((char*)argv); -+ ++ + if (strcmp(argv, file)) { + char *dlm; + pwd = strdupa(argv); -+ ++ + if ((dlm = strrchr(pwd, '/'))) + *dlm = '\0'; + } - /* See if we need to decompress the file(s) first */ - if (cwd[0]) { -+ if (pwd[0]) { - if (debug) -- fprintf (stderr, "chdir %s\n", cwd); +- debug ("chdir %s\n", cwd); - if (chdir (cwd)) { - error (0, errno, _("can't chdir to %s"), cwd); -+ fprintf (stderr, "chdir %s\n", pwd); ++ if (pwd[0]) { ++ debug ("chdir %s\n", pwd); + if (chdir (pwd)) { + error (0, errno, _("can't chdir to %s"), pwd); regain_effective_privs (); @@ -1329,53 +914,35 @@ return NOT_FOUND; } --#ifdef COMP_SRC -- comp = comp_info (argv, 0); -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) -+ comp = comp_info (file, 0); - if (comp) -- if (!decompress(argv, comp)) -+ if (!decompress(file, comp)) - exit_status = CHILD_FAIL; --#endif /* COMP_SRC */ -+#endif /* COMP_SRC && !HAVE_ZIO */ + if (S_ISCHR (st.st_mode) || S_ISBLK (st.st_mode)) { + /* EINVAL is about the best I can do. */ + error (0, EINVAL, "%s", argv); ++ regain_effective_privs (); + return NOT_FOUND; + } + if (exit_status == OK) { char *argv_copy = xstrdup (argv); lang = lang_dir (argv); -- if (!display (NULL, argv, NULL, basename (argv_copy), -- NULL)) { + if (!lang || !*lang) + lang = internal_locale; -+ if (!display (NULL, file, NULL, file, NULL)) { + if (!display (NULL, argv, NULL, basename (argv_copy), + NULL)) { if (local_mf) - error (0, errno, "%s", argv); - exit_status = NOT_FOUND; -@@ -802,22 +806,15 @@ static int local_man_loop (const char *a - free (argv_copy); - } - --#ifdef COMP_SRC -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - remove_ztemp (); --#endif /* COMP_SRC */ -+#endif /* COMP_SRC && !HAVE_ZIO*/ - } - local_man_file = local_mf; - regain_effective_privs (); +@@ -668,12 +671,6 @@ static int local_man_loop (const char *a return exit_status; } -static void int_handler (int signo) -{ -- if (debug) -- fprintf (stderr, "\ninterrupt signal %d handler\n", signo); +- debug ("\ninterrupt signal %d handler\n", signo); - exit (INTERRUPTED); -} - int main (int argc, char *argv[]) { int argc_env, exit_status = OK; -@@ -836,7 +833,16 @@ int main (int argc, char *argv[]) +@@ -692,7 +689,16 @@ int main (int argc, char *argv[]) bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); @@ -1393,7 +960,7 @@ /* Use LANGUAGE only when LC_MESSAGES locale category is * neither "C" nor "POSIX". */ if (internal_locale && strcmp (internal_locale, "C") && -@@ -889,8 +895,6 @@ int main (int argc, char *argv[]) +@@ -745,8 +751,6 @@ int main (int argc, char *argv[]) init_security (); #endif /* SECURE_MAN_UID */ @@ -1401,28 +968,23 @@ - pipeline_install_sigchld (); - if (!catman) -@@ -902,11 +906,16 @@ int main (int argc, char *argv[]) + read_config_file (); +@@ -755,9 +759,13 @@ int main (int argc, char *argv[]) if (external) do_extern (argc, argv); - get_term (); /* stores terminal settings */ #ifdef SECURE_MAN_UID - if (debug) -- fprintf (stderr, "real user = %d; effective user = %d\n", -- ruid, euid); -+ fprintf (stderr, "real user = %d; effective user = %d\n", ruid, euid); -+ else { -+ if (isatty(fileno(stdin)) && isatty(fileno(stdout))) { -+ tcgetattr(fileno(stdin), &tms); -+ if (!tms_set++) -+ atexit(set_term); -+ } + debug ("real user = %d; effective user = %d\n", ruid, euid); ++ if (isatty(fileno(stdin)) && isatty(fileno(stdout))) { ++ tcgetattr(fileno(stdin), &tms); ++ if (!tms_set++) ++ atexit(set_term); + } #endif /* SECURE_MAN_UID */ #ifdef HAVE_SETLOCALE -@@ -927,6 +936,7 @@ int main (int argc, char *argv[]) +@@ -776,6 +784,7 @@ int main (int argc, char *argv[]) setenv ("LANGUAGE", internal_locale, 1); ++_nl_msg_cat_cntr; multiple_locale = NULL; @@ -1430,7 +992,7 @@ } } -@@ -984,6 +994,22 @@ int main (int argc, char *argv[]) +@@ -838,6 +847,22 @@ int main (int argc, char *argv[]) } if (manp == NULL) { @@ -1438,7 +1000,7 @@ + char * tmp_locale = xstrdup(internal_locale); + char * ptr; + -+ manp = manpath (alt_system_name); ++ manp = get_manpath (alt_system_name); + + /* + * Use strsep () to not intermix with strtok () @@ -1453,90 +1015,108 @@ char tmp_locale[3]; int idx; -@@ -1007,6 +1033,7 @@ int main (int argc, char *argv[]) - tmp_locale); +@@ -859,6 +884,7 @@ int main (int argc, char *argv[]) + debug ("checking for locale %s\n", tmp_locale); manp = add_nls_manpath (manp, tmp_locale); } +#endif } else - free (manpath (NULL)); + free (get_manpath (NULL)); -@@ -1333,10 +1360,15 @@ static const char *get_preprocessors_fro - return NULL; - - drop_effective_privs (); -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ fp = fzopen(file, "r"); -+#else - fp = fopen (file, "r"); -+#endif - if (fp) { - if (fgets (line, sizeof (line), fp)) { -- if (!memcmp (line, PP_COOKIE, 4)) { -+ if (!memcmp (line, PP_COOKIE, 4) || -+ (strlen(line) == 6 && !memcmp (line, ".\\\" ", 4))) { - int len; - directive = line + 4; - /* strip trailing newline */ -@@ -1397,8 +1429,8 @@ static const char *get_preprocessors (co - /* This is so that we can store the temp file name used when input is - * stdin and remove it on exit. - */ --static char *stdin_tmpfile; --static int stdin_tmpfile_fd; -+static char *stdin_tmpfile = NULL; -+static int stdin_tmpfile_fd = -1; - - static void remove_stdintmp (void) - { -@@ -1406,6 +1438,7 @@ static void remove_stdintmp (void) - if (stdin_tmpfile_fd >= 0) - close (stdin_tmpfile_fd); - (void) remove_with_dropped_privs (stdin_tmpfile); -+ pop_cleanup(); - free (stdin_tmpfile); - stdin_tmpfile = NULL; - } -@@ -1419,12 +1452,12 @@ static __inline__ void create_stdintmp ( - int oldmask = umask (022); - drop_effective_privs (); - stdin_tmpfile_fd = create_tempfile ("sman", &stdin_tmpfile); -+ regain_effective_privs (); - - if (stdin_tmpfile_fd < 0) - error (FATAL, errno, _("can't create a temporary filename")); -- regain_effective_privs (); -- umask (oldmask); -- atexit (remove_stdintmp); -+ (void)umask (oldmask); -+ push_cleanup((void (*)())remove_stdintmp, NULL); +@@ -1177,7 +1203,7 @@ static __inline__ const char *is_section } - /* Return pipeline to format file to stdout. */ -@@ -1551,9 +1584,22 @@ static pipeline *make_roff_command (cons - const char *output_encoding = NULL, *locale_charset = NULL; + /* Snarf pre-processors from file, return (static) string or NULL on failure */ +-static const char *get_preprocessors_from_file (pipeline *decomp) ++static const char *get_preprocessors_from_file (pipeline *decomp, char * pp_encoding) + { + static char *directive = NULL; - if (*file) { -+#ifdef COMP_SRC -+ struct compression *comp; -+ -+ cmd = command_new_argstr (get_def ("soelim", SOELIM)); -+ if ((comp = comp_info(file, 1))) { -+ /* zsoelim handels gziped files without extension */ -+ command_arg(cmd, comp->stem); -+ free(comp->stem); +@@ -1196,7 +1222,8 @@ static const char *get_preprocessors_fro + if (!line) + return NULL; + +- if (!strncmp (line, PP_COOKIE, 4)) { ++ if (!strncmp (line, PP_COOKIE, 4) || ++ (strlen(line) == 6 && !strncmp(line, ".\\\" ", 4))) { + const char *newline = strchr (line, '\n'); + if (newline) + directive = xstrndup (line + 4, newline - (line + 4)); +@@ -1204,6 +1231,25 @@ static const char *get_preprocessors_fro + directive = xstrdup (line + 4); + } + ++ if (directive && strstr (directive, "-*-")) { ++ const char *pp_search = strstr (directive, "-*-") + 3; ++ while (*pp_search == ' ') ++ ++pp_search; ++ if (STRNEQ (pp_search, "coding:", 7)) { ++ const char *pp_encoding_end; ++ pp_search += 7; ++ while (*pp_search == ' ') ++ ++pp_search; ++ pp_encoding_end = strchr (pp_search, ' '); ++ if (pp_encoding_end) { ++ size_t len = pp_encoding_end - pp_search; ++ pp_encoding = xstrndup (pp_search, len); + } else -+ command_arg (cmd, file); -+ pipeline_command (p, cmd); -+#else - cmd = command_new_argstr (get_def ("soelim", SOELIM)); - command_arg (cmd, file); - pipeline_command (p, cmd); -+#endif - } else { - /* Reading from stdin: use cat to pick up the part we - * read in to figure out the format pipeline. -@@ -1889,6 +1935,18 @@ static void setenv_less (const char *tit ++ pp_encoding = xstrdup (pp_search); ++ debug ("preprocessor encoding: %s\n", pp_encoding); ++ } ++ } ++ + /* if we didn't find PP_COOKIE, then directive == NULL */ + #endif + return directive; +@@ -1212,7 +1258,7 @@ static const char *get_preprocessors_fro + + /* Determine pre-processors, set save_cat and return + (static) string */ +-static const char *get_preprocessors (pipeline *decomp, const char *dbfilters) ++static const char *get_preprocessors (pipeline *decomp, const char *dbfilters, char * pp_encoding) + { + const char *pp_string; + const char *pp_source; +@@ -1226,7 +1272,7 @@ static const char *get_preprocessors (pi + } else if ((pp_string = preprocessors)) { + pp_source = "command line"; + save_cat = 0; +- } else if ((pp_string = get_preprocessors_from_file (decomp))) { ++ } else if ((pp_string = get_preprocessors_from_file (decomp, pp_encoding))) { + pp_source = "file"; + save_cat = 1; + } else if ((pp_string = getenv ("MANROFFSEQ"))) { +@@ -1251,6 +1297,7 @@ static pipeline *make_roff_command (cons + pipeline *decomp, const char *dbfilters) + { + const char *pp_string; ++ char *pp_encoding; + char *fmt_prog; + pipeline *p = pipeline_new (); + command *cmd; +@@ -1259,7 +1306,8 @@ static pipeline *make_roff_command (cons + dir = dir; /* not used unless looking for formatters in catdir */ + #endif + +- pp_string = get_preprocessors (decomp, dbfilters); ++ pp_encoding = (char*)0; ++ pp_string = get_preprocessors (decomp, dbfilters, pp_encoding); + + #ifdef ALT_EXT_FORMAT + /* Check both external formatter locations */ +@@ -1318,7 +1366,10 @@ static pipeline *make_roff_command (cons + + #define STRC(s, otherwise) ((s) ? (s) : (otherwise)) + +- page_encoding = get_page_encoding (lang); ++ if (pp_encoding) ++ page_encoding = pp_encoding; ++ else ++ page_encoding = get_page_encoding (lang); + source_encoding = get_source_encoding (lang); + debug ("page_encoding = %s\n", page_encoding); + debug ("source_encoding = %s\n", source_encoding); +@@ -1632,6 +1683,18 @@ static void setenv_less (const char *tit free (less_opts); } @@ -1555,7 +1135,7 @@ /* Return pipeline to display file. NULL means stdin. * * TODO: htmlout case is pretty weird now. I'd like the intelligence to be -@@ -1901,6 +1959,9 @@ static pipeline *make_display_command (c +@@ -1644,6 +1707,9 @@ static pipeline *make_display_command (c setenv_less (title); @@ -1565,9 +1145,59 @@ if (file) { if (ascii) { p = pipeline_new (); -@@ -2364,16 +2425,24 @@ static int display (const char *dir, con - if (debug) - fprintf (stderr, "chdir %s\n", dir); +@@ -1686,7 +1752,7 @@ static pipeline *make_display_command (c + return p; + } + +- ++#ifdef MAN_CATS + /* return a (malloced) temporary name in cat_file's directory */ + static char *tmp_cat_filename (const char *cat_file) + { +@@ -1789,8 +1855,6 @@ static int commit_tmp_cat (const char *c + return status; + } + +-#ifdef MAN_CATS +- + /* Return pipeline to write formatted manual page to for saving as cat file. */ + static pipeline *open_cat_stream (const char *cat_file) + { +@@ -1864,6 +1928,7 @@ static int close_cat_stream (pipeline *c + free (tmp_cat_file); + return status; + } ++#endif /* MAN_CATS */ + + /* TODO: This should all be refactored after work on the decompression + * library is complete. +@@ -1876,6 +1941,7 @@ void discard_stderr (pipeline *p) + p->commands[i]->discard_err = 1; + } + ++#ifdef MAN_CATS + /* + * format a manual page with format_cmd, display it with disp_cmd, and + * save it to cat_file +@@ -2037,6 +2103,7 @@ static void format_display (pipeline *de + regain_effective_privs (); + } + ++#ifdef MAN_CATS + /* "Display" a page in catman mode, which amounts to saving it. */ + /* TODO: merge with format_display_and_save? */ + static void display_catman (const char *cat_file, pipeline *decomp, +@@ -2074,6 +2141,7 @@ static void display_catman (const char * + pop_cleanup(); + free (tmpcat); + } ++#endif /* MAN_CATS */ + + /* + * optionally chdir to dir, if necessary update cat_file from man_file +@@ -2096,10 +2164,18 @@ static int display (const char *dir, con + if (dir) { + debug ("chdir %s\n", dir); + if (global_manpath) + drop_effective_privs(); @@ -1584,93 +1214,101 @@ } /* define format_cmd */ - { - const char *source_file = NULL; --#ifdef COMP_SRC -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - if (man_file) { - source_file = get_ztemp (); - if (!source_file) -@@ -2381,11 +2450,10 @@ static int display (const char *dir, con - } - #else - source_file = man_file; --#endif /* COMP_SRC */ -+#endif /* COMP_SRC && !HAVE_ZIO */ +@@ -2112,11 +2188,10 @@ static int display (const char *dir, con - if (source_file) -- format_cmd = make_roff_command (dir, source_file, -- dbfilters); -+ format_cmd = make_roff_command (dir, source_file, dbfilters); + if (decomp) { + pipeline_start (decomp); +- format_cmd = make_roff_command (dir, man_file, decomp, +- dbfilters); ++ format_cmd = make_roff_command (dir, man_file, decomp, dbfilters); + } else + format_cmd = NULL; +- ++#ifdef MAN_CATS + /* Get modification time, for commit_tmp_cat(). */ + if (man_file && *man_file) { + struct stat stb; +@@ -2125,7 +2200,7 @@ static int display (const char *dir, con else - format_cmd = NULL; + man_modtime = stb.st_mtime; } -@@ -2589,8 +2657,12 @@ static int display (const char *dir, con +- ++#endif /* MAN_CATS */ + display_to_stdout = troff; + #ifdef TROFF_IS_GROFF + if (htmlout) +@@ -2236,6 +2311,7 @@ static int display (const char *dir, con + printf ("%s", cat_file); + } + putchar ('\n'); ++#ifdef MAN_CATS + } else if (catman) { + if (format) { + if (!save_cat) +@@ -2247,6 +2323,7 @@ static int display (const char *dir, con + display_catman (cat_file, decomp, + format_cmd); + } ++#endif /* MAN_CATS */ + } else if (format) { + /* no cat or out of date */ + pipeline *disp_cmd; +@@ -2296,8 +2373,10 @@ static int display (const char *dir, con } } - pipeline_free (format_cmd); -- +- pipeline_free (decomp); + if (format_cmd) + pipeline_free (format_cmd); -+ -+ if (stdin_tmpfile) -+ remove_stdintmp(); -+ - if (!pause) - pause = found; ++ if (decomp) ++ pipeline_free (decomp); -@@ -2929,13 +3001,13 @@ static int display_filesystem (struct ca - if (cat_file) - free (cat_file); - free (title); -- --#ifdef COMP_SRC -+ -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - /* If ult_src() produced a ztemp file, we need to remove it - * before proceeding. - */ - remove_ztemp (); --#endif /* COMP_SRC */ -+#endif /* COMP_SRC && !HAVE_ZIO */ + if (!prompt) + prompt = found; +@@ -2338,8 +2417,7 @@ static char *find_cat_file (const char * + */ + if (!STREQ (man_file, original)) { + global_manpath = is_global_mandir (man_file); +- cat_path = get_catpath +- (man_file, global_manpath ? SYSTEM_CAT : USER_CAT); ++ cat_path = get_catpath (man_file, (global_manpath ? SYSTEM_CAT : USER_CAT)|FILE_CAT); - return found; + if (cat_path) { + cat_file = convert_name (cat_path, 0); +@@ -2366,8 +2444,7 @@ static char *find_cat_file (const char * } -@@ -3022,11 +3094,11 @@ static int display_database (struct cand - title, in->filter); - if (cat_file) - free (cat_file); --#ifdef COMP_SRC -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) - /* if ult_src() produced a ztemp file, we need to - remove it (and unexist it) before proceeding */ - remove_ztemp (); --#endif /* COMP_SRC */ -+#endif /* COMP_SRC && !HAVE_ZIO */ - } /* else {drop through to the bottom and return 0 anyway} */ - } else -@@ -3103,8 +3175,8 @@ static int display_database_check (struc + global_manpath = is_global_mandir (original); +- cat_path = get_catpath +- (original, global_manpath ? SYSTEM_CAT : USER_CAT); ++ cat_path = get_catpath (original, (global_manpath ? SYSTEM_CAT : USER_CAT)|FILE_CAT); + + if (cat_path) { + cat_file = convert_name (cat_path, 0); +@@ -2899,7 +2976,7 @@ static int display_database_check (struc #ifdef MAN_DB_UPDATES if (!exists && !skip) { - if (debug) -- fprintf (stderr, "dbdelete_wrapper (%s, %p)\n", -- candp->req_name, candp->source); -+ fprintf (stderr, "dbdelete_wrapper (%s, %s)\n", -+ candp->req_name, candp->source->addr); + debug ("dbdelete_wrapper (%s, %p)\n", +- candp->req_name, candp->source); ++ candp->req_name, candp->source->addr); dbdelete_wrapper (candp->req_name, candp->source); } #endif /* MAN_DB_UPDATES */ +@@ -2977,7 +3054,7 @@ static int try_db (const char *manpath, + + /* find out where our db for this manpath should be */ + +- catpath = get_catpath (manpath, global_manpath ? SYSTEM_CAT : USER_CAT); ++ catpath = get_catpath (manpath, (global_manpath ? SYSTEM_CAT : USER_CAT)|FILE_CAT); + if (catpath) { + database = mkdbname (catpath); + free (catpath); --- src/man_db.conf.in -+++ src/man_db.conf.in 2007-02-15 13:07:28.000000000 +0100 -@@ -17,10 +17,17 @@ - # - #MANDATORY_MANPATH /usr/src/pvm3/man - # --MANDATORY_MANPATH /usr/man ++++ src/man_db.conf.in 2007-12-11 13:27:28.109209000 +0100 +@@ -20,6 +20,15 @@ + MANDATORY_MANPATH /usr/man MANDATORY_MANPATH /usr/share/man --MANDATORY_MANPATH /usr/X11R6/man MANDATORY_MANPATH /usr/local/man +MANDATORY_MANPATH /usr/local/share/man +MANDATORY_MANPATH /opt/man @@ -1684,7 +1322,7 @@ #--------------------------------------------------------- # set up PATH to MANPATH mapping # ie. what man tree holds man pages for what binary directory. -@@ -35,8 +42,10 @@ MANPATH_MAP /usr/local/bin /usr/local/m +@@ -34,8 +43,10 @@ MANPATH_MAP /usr/local/bin /usr/local/m MANPATH_MAP /usr/local/bin /usr/local/share/man MANPATH_MAP /usr/local/sbin /usr/local/man MANPATH_MAP /usr/local/sbin /usr/local/share/man @@ -1697,7 +1335,7 @@ MANPATH_MAP /usr/games /usr/share/man MANPATH_MAP /opt/bin /opt/man MANPATH_MAP /opt/sbin /opt/man -@@ -64,12 +73,133 @@ MANPATH_MAP /opt/sbin /opt/man +@@ -63,12 +74,133 @@ MANPATH_MAP /opt/sbin /opt/man # # *MANPATH* -> *CATPATH* # @@ -1819,7 +1457,7 @@ +MANDB_MAP /opt/share/man/is /var/cache/man/opt/is +MANDB_MAP /opt/share/man/it /var/cache/man/opt/it +MANDB_MAP /opt/share/man/ja /var/cache/man/opt/ja -+MANDB_MAP /opt/share/man/a_JP /var/cache/man/opt/ja ++MANDB_MAP /opt/share/man/ja_JP /var/cache/man/opt/ja +MANDB_MAP /opt/share/man/ja_JP.eucJP /var/cache/man/opt/ja +MANDB_MAP /opt/share/man/ko /var/cache/man/opt/ko +MANDB_MAP /opt/share/man/nl /var/cache/man/opt/nl @@ -1836,7 +1474,7 @@ # #--------------------------------------------------------- # Program definitions. These are commented out by default as the value -@@ -81,7 +211,7 @@ MANDB_MAP /opt/man /var/cache/man/opt +@@ -80,7 +212,7 @@ MANDB_MAP /opt/man /var/cache/man/opt #DEFINE tr @tr@ '\255\267\264\327' '\055\157\047\170' #DEFINE grep @grep@ #DEFINE troff @troff@ @@ -1845,15 +1483,18 @@ #DEFINE eqn @eqn@ #DEFINE neqn @neqn@ #DEFINE tbl @tbl@ -@@ -109,4 +239,4 @@ MANDB_MAP /opt/man /var/cache/man/opt +@@ -107,7 +239,7 @@ MANDB_MAP /opt/man /var/cache/man/opt # is that you only need to explicitly list extensions if you want to force a # particular order. Sections with extensions should usually be adjacent to # their main section (e.g. "1 1mh 8 ..."). -SECTION 1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7 +SECTION 0 1 n l 8 3 2 5 4 9 6 7 1x 3x 4x 5x 6x 8x 1bind 3bind 5bind 7bind 8bind 1cn 8cn 1m 1mh 5mh 8mh 1netpbm 3netpbm 5netpbm 0p 1p 3p 1pgsql 3C++ 3blt 3blt 3curses 3ncurses 3form 3menu 3db 3gdbm 3f 3gk 3mm 3paper 3perl 3pgsql 3pm 3posix 3pq 3qt 3pub 3readline 1ssl 3ssl 5ssl 7ssl 3t 3tk 3tcl 3tclx 3tix 5mm 5pgsql 7l 7nr 8C++ 8c Cg g s m + #--------------------------------------------------------- + # Flags. + # NOCACHE keeps man from creating cat pages. --- src/mandb.c -+++ src/mandb.c 2007-02-15 00:00:00.000000000 +0100 -@@ -138,6 +138,8 @@ static char *xtmpfile; ++++ src/mandb.c 2007-12-10 14:09:36.898788000 +0100 +@@ -143,6 +143,8 @@ static const char *xtmpfile; #ifdef SECURE_MAN_UID extern uid_t ruid; extern uid_t euid; @@ -1861,8 +1502,17 @@ +extern gid_t egid; #endif /* SECURE_MAN_UID */ - extern char *optarg; -@@ -502,8 +504,14 @@ int main (int argc, char *argv[]) + static char *manpathlist[MAXDIRS]; +@@ -497,7 +499,7 @@ static short process_manpath (const char + if (!opt_test && amount) { + finish_up (); + #ifdef SECURE_MAN_UID +- if (global_manpath && euid == 0) ++ if (global_manpath && (euid == 0 || ruid == 0)) + do_chown (man_owner->pw_uid); + #endif /* SECURE_MAN_UID */ + } +@@ -610,8 +612,14 @@ int main (int argc, char *argv[]) error (FAIL, 0, _("the setuid man user \"%s\" does not exist"), MAN_OWNER); @@ -1879,18 +1529,9 @@ #endif /* SECURE_MAN_UID */ -@@ -579,7 +587,7 @@ int main (int argc, char *argv[]) - if (!opt_test && amount_changed) { - finish_up (); - #ifdef SECURE_MAN_UID -- if (global_manpath && euid == 0) -+ if (global_manpath && (euid == 0 || ruid == 0)) - do_chown (man_owner->pw_uid); - #endif /* SECURE_MAN_UID */ - } else --- src/manp.c -+++ src/manp.c 2007-02-15 00:00:00.000000000 +0100 -@@ -54,6 +54,7 @@ ++++ src/manp.c 2007-12-11 15:26:40.430198000 +0100 +@@ -63,6 +63,7 @@ # include #else /* no string(s) header */ extern char *strtok(); @@ -1898,42 +1539,15 @@ extern char *strchr(); extern char *strstr(); #endif -@@ -75,6 +76,7 @@ extern int errno; - #include "lib/getcwdalloc.h" +@@ -86,6 +87,7 @@ extern int errno; #include "security.h" + #include "encodings.h" #include "manp.h" +#include "security.h" struct list { char *key; -@@ -403,7 +405,7 @@ char *add_nls_manpath (char *manpathlist - fprintf (stderr, "add_nls_manpath(): processing %s\n", - manpathlist); - -- if (locale == NULL || *locale == '\0' || *locale == 'C') -+ if (locale == NULL || *locale == '\0' || *locale == 'C' || (strcmp(locale, "POSIX") == 0)) - return manpathlist; - - temp_locale = xstrdup (locale); -@@ -411,7 +413,7 @@ char *add_nls_manpath (char *manpathlist - for (path = strsep (&manpathlist_ptr, ":"); path; - path = strsep (&manpathlist_ptr, ":") ) { - -- static char locale_delims[] = "@,._"; -+ static char locale_delims[] = ":@,._"; - char *delim, *tempo; - char *testpath; - -@@ -423,7 +425,7 @@ char *add_nls_manpath (char *manpathlist - free (testpath); - } - for (delim = locale_delims; *delim != '\0'; ++delim) { -- tempo = strchr (temp_locale, *delim); -+ tempo = strrchr (temp_locale, *delim); - if (tempo) { - /* Strip out the rest of the line */ - *tempo = '\0'; -@@ -633,6 +635,8 @@ char *manpath (const char *systems) +@@ -694,6 +696,8 @@ char *get_manpath (const char *systems) #ifdef SECURE_MAN_UID extern uid_t ruid; /* initial real user id */ extern uid_t euid; /* initial effective user id */ @@ -1942,7 +1556,7 @@ #endif /* SECURE_MAN_UID */ /* create the catman hierarchy if it doesn't exist */ -@@ -664,6 +668,8 @@ mkcatdirs (const char *mandir, const cha +@@ -722,6 +726,8 @@ mkcatdirs (const char *mandir, const cha #ifdef SECURE_MAN_UID if (ruid == 0) chown (catdir, man_owner->pw_uid, 0); @@ -1951,10 +1565,10 @@ #endif /* SECURE_MAN_UID */ drop_effective_privs (); } -@@ -677,9 +683,14 @@ mkcatdirs (const char *mandir, const cha - fprintf (stderr, - "creating catdir hierarchy %s ", - catdir); +@@ -732,9 +738,14 @@ mkcatdirs (const char *mandir, const cha + int j; + regain_effective_privs (); + debug ("creating catdir hierarchy %s ", catdir); - for (j = 1; j <= 9; j++) { - catname[strlen (catname) - 1] = '0' + j; - manname[strlen (manname) - 1] = '0' + j; @@ -1969,23 +1583,23 @@ if ((is_directory (manname) == 1) && (is_directory (catname) != 1)) { if (mkdir (catname, -@@ -689,11 +700,12 @@ mkcatdirs (const char *mandir, const cha - if (debug) - fprintf (stderr, "warning: cannot create catdir %s\n", catname); - } else if (debug) -- fprintf (stderr, " cat%d", j); -+ fprintf (stderr, " cat%c", c); +@@ -743,11 +754,12 @@ mkcatdirs (const char *mandir, const cha + error (0, 0, _("warning: cannot create catdir %s"), catname); + debug ("warning: cannot create catdir %s\n", catname); + } else +- debug (" cat%d", j); ++ debug (" cat%c", c); #ifdef SECURE_MAN_UID if (ruid == 0) - chown (catname, - man_owner->pw_uid, 0); + chown (catname, man_owner->pw_uid, 0); + if (rgid == 0) -+ chown (catdir, -1, man_owner->pw_gid); ++ chown (catname, -1, man_owner->pw_gid); #endif /* SECURE_MAN_UID */ } } -@@ -819,7 +831,7 @@ static char *def_path (int flag) +@@ -886,7 +898,7 @@ static char *def_path (int flag) /* If we have complete config file failure... */ if (!manpath) @@ -1994,7 +1608,7 @@ return manpath; } -@@ -1095,16 +1107,18 @@ char *get_catpath (const char *name, int +@@ -1164,16 +1176,30 @@ char *get_catpath (const char *name, int if (*suffix == '/') { ++suffix; @@ -2010,16 +1624,28 @@ } catpath = strappend (catpath, suffix, NULL); - return catpath; -+ ++ if (cattype & FILE_CAT) ++ return catpath; + if (is_directory (catpath) == 1) + return catpath; -+ else -+ free (catpath); ++ if ((cattype & WHATIS_CAT) == 0) { ++ const char locale_delims[] = "_@,."; ++ const char *delim; ++ for (delim = locale_delims; *delim != '\0'; ++delim) { ++ char * tmp = strrchr (catpath, *delim); ++ if (!tmp) ++ continue; ++ *tmp = '\0'; ++ if (is_directory (catpath) == 1) ++ return catpath; ++ } ++ } ++ free (catpath); } } --- src/security.c -+++ src/security.c 2007-02-15 00:00:00.000000000 +0100 ++++ src/security.c 2007-12-10 14:24:24.347643000 +0100 @@ -87,10 +87,13 @@ extern int errno; # ifdef POSIX_SAVED_IDS # if defined (HAVE_SETEUID) @@ -2071,10 +1697,10 @@ + rgid = getgid (); uid = euid = geteuid (); + gid = egid = getegid (); - if (debug) - fprintf (stderr, "ruid=%d, euid=%d\n", (int) ruid, (int) euid); + debug ("ruid=%d, euid=%d\n", (int) ruid, (int) euid); priv_drop_count = 0; -@@ -208,6 +223,28 @@ void regain_effective_privs (void) + drop_effective_privs (); +@@ -202,6 +217,28 @@ void regain_effective_privs (void) uid = euid; } @@ -2104,7 +1730,7 @@ } --- src/straycats.c -+++ src/straycats.c 2007-02-15 00:00:00.000000000 +0100 ++++ src/straycats.c 2007-12-10 16:03:23.563387000 +0100 @@ -48,6 +48,7 @@ extern char *strrchr(); #include @@ -2113,18 +1739,7 @@ #if defined(HAVE_UNISTD_H) # include -@@ -92,8 +93,8 @@ extern char *canonicalize_file_name __P - #include "manp.h" - #include "security.h" - --static char *temp_name; --static char *catdir, *mandir; -+static char *temp_name = NULL; -+static char *catdir = NULL, *mandir = NULL; - - static int check_for_stray (void) - { -@@ -101,12 +102,6 @@ static int check_for_stray (void) +@@ -102,12 +103,6 @@ static int check_for_stray (void) struct dirent *catlist; size_t lenman, lencat; int strays = 0; @@ -2137,184 +1752,67 @@ cdir = opendir (catdir); if (!cdir) { -@@ -198,6 +193,11 @@ static int check_for_stray (void) +@@ -197,6 +192,11 @@ static int check_for_stray (void) found = 0; - if (!found) { + if (!found) { +#ifdef HAVE_CANONICALIZE_FILE_NAME + char *fullpath; /* no PATH_MAX then */ +#else + char fullpath[PATH_MAX]; +#endif - pipeline *filter; + pipeline *decomp; struct mandata *exists; lexgrog lg; -@@ -306,7 +306,8 @@ static int check_for_stray (void) - char *filter_str = - pipeline_tostring (filter); - remove_with_dropped_privs (temp_name); -- perror (filter_str); -+ if (debug) -+ perror (filter_str); - free (filter_str); - } else { - struct page_description *descs; -@@ -338,8 +339,11 @@ static int check_for_stray (void) - } - } - -- pipeline_free (filter); -- free (mandir_copy); -+ if (filter) -+ pipeline_free (filter); -+ -+ if (mandir_copy) -+ free (mandir_copy); +@@ -312,13 +312,17 @@ static int check_for_stray (void) if (lg.whatis) free (lg.whatis); +- pipeline_free (decomp); ++ if (decomp) ++ pipeline_free (decomp); + next_exists: +- free_mandata_struct (exists); +- free (mandir_copy); ++ if (exists) ++ free_mandata_struct (exists); ++ if (mandir_copy) ++ free (mandir_copy); + } + next_section: +- free (section); ++ if (section) ++ free (section); + } + closedir (cdir); + return strays; --- src/ult_src.c -+++ src/ult_src.c 2007-02-15 00:00:00.000000000 +0100 -@@ -37,6 +37,9 @@ - #include - #include - #include -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+# include -+#endif - - #ifndef STDC_HEADERS - extern int errno; -@@ -229,7 +232,7 @@ const char *ult_src (const char *name, c - struct stat *buf, int flags) - { - static char *basename; /* must be static */ -- static short recurse; /* must be static */ -+ static short recurse = 0; /* must be static */ - - /* initialise the function */ - -@@ -297,10 +300,10 @@ const char *ult_src (const char *name, c - FILE *fp; - #ifdef COMP_SRC - struct compression *comp; -- -+# ifndef HAVE_ZIO - /* get rid of the previous ztemp file (if any) */ - remove_ztemp (); -- -+# endif - /* if we are handed the name of a compressed file, remove - the compression extension? */ - comp = comp_info (basename, 1); -@@ -309,7 +312,7 @@ const char *ult_src (const char *name, c - basename = comp->stem; - comp->stem = NULL; /* steal memory */ ++++ src/ult_src.c 2007-12-10 14:34:00.376977000 +0100 +@@ -328,12 +328,17 @@ const char *ult_src (const char *name, c } -- -+# ifndef HAVE_ZIO - /* if the open fails, try looking for compressed */ - fp = fopen (basename, "r"); - if (fp == NULL) { -@@ -334,6 +337,21 @@ const char *ult_src (const char *name, c - return NULL; - } - } -+# else -+ if ((comp = comp_file(basename))) { -+ free(comp->stem); -+ basename = strappend (basename, ".", comp->ext, NULL); -+ } -+ -+ drop_effective_privs (); -+ fp = fzopen(basename, "r"); -+ regain_effective_privs (); -+ -+ if (fp == NULL) { -+ error (0, errno, _( "can't open %s"), basename); -+ return NULL; -+ } -+# endif - #else - fp = fopen (basename, "r"); - if (fp == NULL) { -@@ -341,18 +359,35 @@ const char *ult_src (const char *name, c - return NULL; - } - #endif + pipeline_start (decomp); + - /* make sure that we skip over any comments */ + /* + * make sure that we skip over any comments + * ... even if we handle TCL/TK manual pages + */ do { - bptr = fgets (buffer, 1024, fp); -- } while (bptr && STRNEQ (buffer, ".\\\"", 3)); -- -+ } while (bptr && *bptr && + buffer = pipeline_readline (decomp); +- } while (buffer && STRNEQ (buffer, ".\\\"", 3)); ++ } while (buffer && *buffer && + (STRNEQ (buffer, ".\\\"", 3) || -+ STRNEQ (buffer, "'\\\"", 3) -+ )); -+ -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ /* -+ * Isn't very useful to close it now ... maybe we need it -+ * later for further handling. -+ */ -+ if (!(flags & WHATISBUF)) -+#endif - fclose(fp); ++ STRNEQ (buffer, "'\\\"", 3))); - if (buffer) { -+ if (bptr && *bptr) { ++ if (buffer && *buffer) { char *include = test_for_include (buffer); if (include) { const char *ult; - -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ if (flags & WHATISBUF) /* not needed */ -+ fclose(fp); -+#endif - /* Restore the original path from before - * ult_softlink() etc., in case it went - * outside the mantree. -@@ -373,7 +408,32 @@ const char *ult_src (const char *name, c - - return ult; - } -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ else if (flags & WHATISBUF) { -+ char whatis[8192], *w; -+ int len = 0; -+ -+ while (bptr && *bptr && !(strncasecmp(buffer, ".SH", 3) == 0 || -+ strncasecmp(buffer, ".SS", 3) == 0 || -+ strncasecmp(buffer, ".SY", 3) == 0)) -+ bptr = fgets(buffer, 1024, fp); -+ -+ w = strcpy(whatis, buffer); -+ len = strlen(whatis); -+ w += len; -+ -+ if ((len = fread(w, (8192 - len), sizeof(char), fp)) > 0) { -+ whatis[sizeof(whatis)-1] = '\0'; -+ } -+ set_wbuf(whatis); -+ } -+#endif - } -+#if defined(COMP_SRC) && defined(HAVE_ZIO) -+ /* Now we've handled whatis, close the manual page */ -+ if (flags & WHATISBUF) -+ fclose(fp); -+#endif - } - - /* We have the ultimate source */ --- src/ult_src.h -+++ src/ult_src.h 2007-02-15 00:00:00.000000000 +0100 ++++ src/ult_src.h 2007-12-10 13:24:29.922796000 +0100 @@ -21,9 +21,10 @@ - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#define SO_LINK 0001 @@ -2328,7 +1826,7 @@ extern const char *ult_src (const char *name, const char *path, struct stat *buf, int flags); --- src/util.c -+++ src/util.c 2007-02-15 00:00:00.000000000 +0100 ++++ src/util.c 2007-12-10 13:24:29.958801000 +0100 @@ -58,6 +58,9 @@ extern char *strcpy(); # include #endif /* HAVE_UNISTD_H */ @@ -2339,8 +1837,19 @@ #include "manconfig.h" #include "libdb/mydbm.h" /* for full definition of MAN_DB */ #include "lib/pipeline.h" +--- src/whatis.c ++++ src/whatis.c 2007-12-11 15:30:48.289713000 +0100 +@@ -687,7 +687,7 @@ static int search (char *page) + debug ("lower(%s) = \"%s\"\n", page, lowpage); + + for (mp = manpathlist; *mp; mp++) { +- catpath = get_catpath (*mp, SYSTEM_CAT | USER_CAT); ++ catpath = get_catpath (*mp, SYSTEM_CAT|USER_CAT|WHATIS_CAT); + + if (catpath) { + database = mkdbname (catpath); --- src/wrapper.c -+++ src/wrapper.c 2007-02-15 00:00:00.000000000 +0100 ++++ src/wrapper.c 2007-12-10 16:05:45.493435000 +0100 @@ -25,6 +25,7 @@ #include #include @@ -2349,7 +1858,7 @@ #include #include #include -@@ -51,7 +52,7 @@ +@@ -48,7 +49,7 @@ * it is fixed at compile time to avoid a full class of * dangers ... */ @@ -2358,26 +1867,23 @@ const char *prog; const char *run; const char *user; -@@ -65,12 +66,13 @@ struct { - { "mandb", "/usr/lib/man-db/mandb", "man" }, - { 0, 0, 0, }}; +@@ -64,10 +65,11 @@ struct { --char *program_name; -+static char *program_name; + char *program_name; -int main (int argc, char **argv) -+int main (int argc, char *argv[], char *envp[]) ++int main (int argc, char **argv, char *envp[]) { - uid_t ruid; - char *fakeroot; + uid_t ruid, euid; + gid_t rgid; +// char *fakeroot; - char *p; struct passwd *pwd; -@@ -88,57 +90,49 @@ int main (int argc, char **argv) - program_name = (p ? ++p : argv[0]); + argc = argc; /* not used */ +@@ -83,57 +85,49 @@ int main (int argc, char **argv) + program_name = xstrdup (basename (argv[0])); ruid = getuid (); - fakeroot = getenv ("FAKEROOTKEY"); @@ -2457,132 +1963,3 @@ + perror ("execve"); return -errno; } ---- zsoelim/zsoelim.l -+++ zsoelim/zsoelim.l 2007-02-15 00:00:00.000000000 +0100 -@@ -31,8 +31,20 @@ - * - added changes that were done to .c instead of -l source - * - added new start condition to avoid execution of .so requests - * inside a macro definition. -+ * -+ * Fri Jun 4 18:18:34 CEST 1999 Werner Fink -+ * - Create temporary file exclusive before decompresion -+ * -+ * Wed Jun 30 21:46:20 CEST 1999 Werner Fink -+ * - Use cleanup functions, kill possible childs to close all -+ * open file handles of our temporary files. -+ * - Use fopencookie combined with zlib and a workaround to -+ * make cookie_close_function working. -+ * -+ * Wed Apr 21 15:00:21 CEST 2004 Werner Fink -+ * - Use libzio together with libz and libbz2 -+ * - */ -- - #define MAX_SO_DEPTH 10 /* max .so recursion depth */ - #undef ACCEPT_QUOTES /* accept quoted roff requests */ - -@@ -60,6 +72,7 @@ extern int strncmp(); - #include - #include - #include -+#include - - #ifndef STDC_HEADERS - extern int errno; -@@ -88,8 +101,12 @@ extern int errno; - #endif /* HAVE_GETOPT_H */ - - #ifdef COMP_SRC --#include "comp_src.h" -+# ifdef HAVE_ZIO -+# include -+# else - static char* so_delete[MAX_SO_DEPTH]; -+# endif -+# include "comp_src.h" - #endif /* COMP_SRC */ - - static int open_file (char *filename); -@@ -284,9 +301,13 @@ W [ \t] - <> { - fclose (yyin); - --#ifdef COMP_SRC -- if (so_delete[so_stack_ptr]) -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) -+ if (so_delete[so_stack_ptr]) { - remove (so_delete[so_stack_ptr]); -+ pop_cleanup(); -+ /* was allocated by tempnam */ -+ free(so_delete[so_stack_ptr]); -+ } - #endif - if (no_newline) - putchar ('\n'); -@@ -346,6 +367,19 @@ static void parse_file (void) - yylex (); - } - -+#if defined(COMP_SRC) && !defined(HAVE_ZIO) -+static int do_emergency_unlink(const char* filename) -+{ -+ /* kill pending childs because unlink only -+ works if no processes have the file open */ -+ if ( setpgrp() == 0 ) { -+ signal(SIGHUP, SIG_IGN); -+ kill(-getpid(), SIGHUP); -+ } -+ return unlink (filename); -+} -+#endif -+ - int main (int argc, char *argv[]) - { - int c, option_index; -@@ -382,6 +416,7 @@ int main (int argc, char *argv[]) - } - } - -+ pop_all_cleanups(); - return status; - } - -@@ -446,6 +481,7 @@ static int open_file (char *filename) - compfile = filename; - - if (comp->ext) { -+#ifndef HAVE_ZIO - command *decompress_cmd; - pipeline *decompress; - int exit_status; -@@ -459,8 +495,13 @@ static int open_file (char *filename) - decompress = pipeline_new_commands - (decompress_cmd, NULL); - decompress->want_out = file_fd; -+ -+ so_delete[so_stack_ptr] = filename; -+ push_cleanup ((void (*)())do_emergency_unlink, filename); -+ - pipeline_start (decompress); - exit_status = pipeline_wait (decompress); -+ - close (file_fd); - - if (exit_status != 0) { -@@ -483,8 +524,14 @@ static int open_file (char *filename) - yyin = oldyyin; - return 1; - } -- -- so_delete[so_stack_ptr] = filename; -+#else /* HAVE_ZIO */ -+ if ( !(yyin = fzopen(compfile, "r")) ) { -+ error (0, errno, "open compressed stream: %s", -+ compfile); -+ yyin = oldyyin; -+ return 1; -+ } -+#endif /* HAVE_ZIO */ - NAME = compfile; - return 0; - } diff --git a/man-db-2.5.0.tar.bz2 b/man-db-2.5.0.tar.bz2 new file mode 100644 index 0000000..f0ac4c7 --- /dev/null +++ b/man-db-2.5.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6dbb18464fe31cd52fb6287b63829e556a77746b81899c743c327b15ad9e434 +size 746743 diff --git a/man-db_2.5.0-4.diff.bz2 b/man-db_2.5.0-4.diff.bz2 new file mode 100644 index 0000000..065f162 --- /dev/null +++ b/man-db_2.5.0-4.diff.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7eb73655f06e81b910fad7a7c93b0b1ddd84fde0fec3a72c684f9e43bc7e0d9f +size 1230 diff --git a/man.changes b/man.changes index 8f35c04..7caf04a 100644 --- a/man.changes +++ b/man.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Mon Dec 10 17:23:04 CET 2007 - werner@suse.de + +- Update to man-db 2.5.0-4 + * No temporary files anymore due usage of pipes + * Our libzio patch is simply to add due this new API + * Better UTF-8 support + * Disable straycats for now +- Add sample script mancoding to show how to use encoding tag + ------------------------------------------------------------------- Wed Sep 19 13:39:50 CEST 2007 - werner@suse.de diff --git a/man.spec b/man.spec index 9e894f7..6612b94 100644 --- a/man.spec +++ b/man.spec @@ -1,5 +1,5 @@ # -# spec file for package man (Version 2.4.3) +# spec file for package man (Version 2.5.0) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -17,8 +17,8 @@ BuildRequires: gdbm-devel less libbz2-devel libzio-devel zlib-devel %else BuildRequires: libzio util-linux %endif -Version: 2.4.3 -Release: 84 +Version: 2.5.0 +Release: 1 Summary: A Program for Displaying man Pages License: GPL v2 or later Group: System/Base @@ -30,17 +30,19 @@ Source: man-db-%{version}.tar.bz2 Source1: sysconfig.cron-man Source2: cron.daily.do_mandb Source3: cron.daily.clean_catman +Source4: mancoding Patch0: man-db-%{version}.dif -Patch1: man-db-%{version}-6.diff.bz2 +Patch1: man-db_%{version}-4.diff.bz2 Patch2: man-db-2.3.19deb4.0-groff.dif -Patch3: man-db-2.4.1-error.dif -Patch4: man-db-%{version}-section.dif -Patch5: man-db-2.4.1-security2.dif -Patch6: man-db-2.4.1-security4.dif -Patch7: man-db-2.4.3-firefox.dif -Patch8: man-db-2.4.3-chinese.dif -Patch9: man-db-2.4.3-globbing.dif +Patch3: man-db-%{version}-error.dif +Patch4: man-db-2.4.3-section.dif +Patch5: man-db-%{version}-security4.dif +Patch6: man-db-2.4.3-firefox.dif +Patch7: man-db-%{version}-chinese.dif +Patch8: man-db-2.4.3-globbing.dif +Patch9: man-db-%{version}-zio.dif BuildRoot: %{_tmppath}/%{name}-%{version}-build +%global _sysconfdir /etc %description A program for displaying man pages on the screen or sending them to a @@ -58,43 +60,87 @@ Authors: %patch2 -p0 -b .groff %patch3 -p0 -b .err %patch4 -p0 -b .sect -%patch5 -p0 -b .secu2 -%patch6 -p0 -b .secu4 -%patch7 -p0 -b .firefox -%patch8 -p0 -b .chinese -%patch9 -p0 -b .globbing +%patch5 -p0 -b .secu4 +%patch6 -p0 -b .firefox +%patch7 -p0 -b .chinese +%patch8 -p0 -b .globbing +%patch9 -p0 -b .zio %patch -p0 %build %{?suse_update_config:%{suse_update_config -f tools }} gettextize --force --copy --no-changelog rm -f configure GNUmakefile - echo $RPM_OPT_FLAGS - make -f Makefile.Linux compile MANDIR=%{_mandir} SYSCONFDIR=%{_sysconfdir} + CFLAGS="${RPM_OPT_FLAGS} -funroll-loops -pipe -D_GNU_SOURCE -D_SVID_SOURCE -Wall" + LDFLAGS= + LIBS= + export CFLAGS LDFLAGS LIBS +# aclocal + autoconf + ./configure \ + --enable-dups \ + --enable-setuid=man \ + --with-device=utf8 \ + --prefix=%{_prefix} \ + --mandir=%{_mandir} \ + --localstatedir=%{_localstatedir} \ + --with-zio \ + --with-gnu-ld \ + --disable-rpath \ + --enable-mb-groff \ + --with-db=gdbm \ + --enable-nls \ + --with-config-file=%{_sysconfdir}/manpath.config \ + --without-included-gettext + make nls=all + for man in $(find man/*.UTF-8 -type f); do + pp="$(head -n 1 $man)" + case "$pp" in + \'\\\"*\ -\*-\ coding:\ *\ -\*-) + continue + ;; + \'\\\"*) + sed -ri "1{ s/('\\\\\".*)/\\1 -\*- coding: UTF-8 -\*-/ }" $man + ;; + *) + sed -ri "1 i\ + '\\\\\" -\*- coding: UTF-8 -\*-\ + " $man + esac + done %install -set +o posix -#touch /tmp/bstamp; sleep 3; sync - rm -rf ${RPM_BUILD_ROOT}/var/cache/man - DESTDIR=${RPM_BUILD_ROOT} - export DESTDIR - make -f Makefile.Linux install MANDIR=%{_mandir} - mkdir -p ${RPM_BUILD_ROOT}/usr/share/groff/site-tmac - install -m 0644 groff/tmac.andb ${RPM_BUILD_ROOT}/usr/share/groff/site-tmac/ - install -m 0644 groff/tmac.andocdb ${RPM_BUILD_ROOT}/usr/share/groff/site-tmac/ - mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates - mkdir -p ${RPM_BUILD_ROOT}/etc/cron.daily - install -m 0644 %{SOURCE1} ${RPM_BUILD_ROOT}/var/adm/fillup-templates - install -m 0744 %{SOURCE2} ${RPM_BUILD_ROOT}/etc/cron.daily/suse-do_mandb - install -m 0744 %{SOURCE3} ${RPM_BUILD_ROOT}/etc/cron.daily/suse-clean_catman - /usr/sbin/Check -#touch /tmp/estamp; sleep 3; sync -#( -# find / -xdev \( -newer /tmp/bstamp -a \( -not -newer /tmp/estamp \) \) -a \( \ -# \( \( \( -not -type d \) -a \( -not -type l \) \) -printf '%%p\n' \) -o \ -# \( -type d -printf '%%p/\n' \) -o \( -type l -printf '%%p\n' \) \) -#) > >(sort -u -t / | grep -vE '^(/tmp|/proc|/usr/src/packages)' > /tmp/man.list) -#rm /tmp/estamp /tmp/bstamp + rm -rf %{buildroot}%{_localstatedir}/cache/man + mkdir -p %{buildroot}%{_prefix}/lib/man-db + mkdir -p %{buildroot}%{_bindir} + mkdir -p %{buildroot}/etc + make nls=all install DESTDIR=%{buildroot} + if test -x %{buildroot}%{_bindir}/wrapper ; then + rm -f %{buildroot}%{_bindir}/mandb + rm -f %{buildroot}%{_bindir}/man + mv %{buildroot}%{_bindir}/wrapper %{buildroot}%{_bindir}/mandb + ln -sf mandb %{buildroot}%{_bindir}/man + fi + mkdir -p %{buildroot}%{_mandir} + pushd %{buildroot}%{_mandir}/ + rm -rf *.ascii/ + for d in *.UTF-8 ; do + find -name '*.[1-9nlop]' | xargs gzip -9f + done + for d in `find -name manpath.5.gz -printf '%%h '` ; do + ln -sf manpath.5.gz $d/manpath.config.5.gz + done + popd + install -m 644 src/man_db.conf %{buildroot}%{_sysconfdir}/manpath.config + sh ./mk_catdirs %{buildroot} + mkdir -p %{buildroot}%{_datadir}/groff/site-tmac + install -m 0644 groff/tmac.andb %{buildroot}%{_datadir}/groff/site-tmac/ + install -m 0644 groff/tmac.andocdb %{buildroot}%{_datadir}/groff/site-tmac/ + mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates + mkdir -p %{buildroot}/etc/cron.daily + install -m 0644 %{SOURCE1} %{buildroot}%{_localstatedir}/adm/fillup-templates + install -m 0744 %{SOURCE2} %{buildroot}/etc/cron.daily/suse-do_mandb + install -m 0744 %{SOURCE3} %{buildroot}/etc/cron.daily/suse-clean_catman %find_lang man-db %pre @@ -108,20 +154,21 @@ test -d var/catman/ && rm -rf var/catman/ || true %config /etc/manpath.config %attr(0744,root,root) /etc/cron.daily/suse-clean_catman %attr(0744,root,root) /etc/cron.daily/suse-do_mandb -/usr/bin/apropos -/usr/bin/catman -/usr/bin/lexgrog -%attr(4755,root,root) /usr/bin/man -%attr(4755,root,root) /usr/bin/mandb -/usr/bin/manpath -/usr/bin/whatis -/usr/bin/zsoelim -%dir %attr(0711,root,root) /usr/lib/man-db -%attr(0711,root,root) /usr/lib/man-db/man -%attr(0711,root,root) /usr/lib/man-db/mandb -/usr/sbin/accessdb -/usr/share/groff/site-tmac/tmac.andb -/usr/share/groff/site-tmac/tmac.andocdb +%{_bindir}/apropos +%{_bindir}/catman +%{_bindir}/lexgrog +%attr(4755,root,root) %{_bindir}/man +%attr(4755,root,root) %{_bindir}/mandb +%{_bindir}/manpath +%{_bindir}/whatis +%{_bindir}/zsoelim +%dir %attr(0711,root,root) %{_prefix}/lib/man-db +%attr(0711,root,root) %{_prefix}/lib/man-db/man +%attr(0711,root,root) %{_prefix}/lib/man-db/mandb +%attr(0755,man,man) %{_prefix}/lib/man-db/manconv +%{_sbindir}/accessdb +%{_datadir}/groff/site-tmac/tmac.andb +%{_datadir}/groff/site-tmac/tmac.andocdb %dir %{_mandir}/de %dir %{_mandir}/de/man1 %doc %{_mandir}/de/man1/*.1.gz @@ -161,9 +208,17 @@ test -d var/catman/ && rm -rf var/catman/ || true %doc %{_mandir}/man5/*.5.gz %doc %{_mandir}/man8/*.8.gz %defattr(-,man,daemon) -/var/cache/man/* -/var/adm/fillup-templates/sysconfig.cron-man +%{_localstatedir}/cache/man/* +%{_localstatedir}/adm/fillup-templates/sysconfig.cron-man + %changelog +* Mon Dec 10 2007 - werner@suse.de +- Update to man-db 2.5.0-4 + * No temporary files anymore due usage of pipes + * Our libzio patch is simply to add due this new API + * Better UTF-8 support + * Disable straycats for now +- Add sample script mancoding to show how to use encoding tag * Wed Sep 19 2007 - werner@suse.de - Be sure that e.g. /usr/share/man/man3p/open.3p.gz is found before /usr/share/man/man3/open.3pm.gz by "man 3p open" (bug #310498) diff --git a/mancoding b/mancoding new file mode 100644 index 0000000..ca5e9ef --- /dev/null +++ b/mancoding @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Copyright (c) 2007 Werner Fink +# Copyright (c) 2007 SuSE Linux Products GmbH, Nuernberg, Germany. +# +# This library is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or (at +# your option) any later version. +# +# This library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# For a copy see +# +# Author: Werner Fink + +docode=yes +if test "$1" = "-e" ; then + shift + encode=$1 + docode=no + shift +fi + +for man; do + pp="$(head -n 1 $man)" + case "$pp" in + \'\\\"*\ -\*-\ coding:\ *\ -\*-) + continue + esac + if test "$docode" = "yes" ; then + encode=$(sed -r "s/^(\.[[:alpha:]]{1,2}|\.\\\\\".*|'\\\\\".*)//;s/\\f[[:alpha:]]//;s/\\\\\".*//" $man | file -b -) + encode=${encode%% *} + fi + case "$encode" in + ISO-8859) + echo "${0##*/}: The encoding $encode does not include the Latin Alphabet Number" 1>&2 + echo "${0##*/}: use option -e to specify" 1>&2 + echo " ${0##*/} -e ISO-8859- $man" 1>&2 + exit 1 + esac + case "$pp" in + \'\\\"*) + sed -ri "1{s/('\\\\\".*)/\\1 -\*- coding: UTF-8 -\*-/}" $man + ;; + *) + sed -ri "1 i\ + '\\\\\" -\*- coding: UTF-8 -\*-\ + " $man + esac +done