This commit is contained in:
parent
7a4e1342c5
commit
aaa53c3859
165
man-db-2.5.1-listall.dif
Normal file
165
man-db-2.5.1-listall.dif
Normal file
@ -0,0 +1,165 @@
|
||||
--- src/man.c
|
||||
+++ src/man.c 2008-06-06 13:59:22.886201526 +0000
|
||||
@@ -3208,12 +3208,108 @@ static int locate_page (const char *manp
|
||||
return found;
|
||||
}
|
||||
|
||||
+#ifndef PROMPT_IF_MULTIPLE_SECTIONS
|
||||
+#define PROMPT_IF_MULTIPLE_SECTIONS 2 /* 0: No prompt; 1: Show possible sections; 2: Do prompt for */
|
||||
+#endif
|
||||
+
|
||||
+#if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS > 1)
|
||||
+static sig_atomic_t expired;
|
||||
+static void handler(int sig)
|
||||
+{
|
||||
+ (void)sig;
|
||||
+ expired++;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
static int display_pages (struct candidate *candidates)
|
||||
{
|
||||
struct candidate *candp;
|
||||
int found = 0;
|
||||
|
||||
+#if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS > 1)
|
||||
+ char reqsect[64] = { 0 };
|
||||
+ ssize_t len;
|
||||
+ do {
|
||||
+ struct sigaction sa;
|
||||
+ int used = 0x2A;
|
||||
+
|
||||
+ if (findall)
|
||||
+ break;
|
||||
+ if (external)
|
||||
+ break;
|
||||
+ if ((troff + catman + (print_where || print_where_cat)))
|
||||
+ break;
|
||||
+ if (getenv("MAN_POSIXLY_CORRECT"))
|
||||
+ break;
|
||||
+ if (!isatty(STDOUT_FILENO))
|
||||
+ break;
|
||||
+ if (!isatty(STDERR_FILENO))
|
||||
+ break;
|
||||
+ if (!isatty(STDIN_FILENO))
|
||||
+ break;
|
||||
+ if (candidates->next == (struct candidate*)0)
|
||||
+ break;
|
||||
+
|
||||
+ fputs("Man: ", stderr);
|
||||
+ fputs(_("find all matching manual pages"), stderr);
|
||||
+ fputc('\n', stderr);
|
||||
+
|
||||
+ for (candp = candidates; candp; candp = candp->next) {
|
||||
+ struct mandata *info = candp->source;
|
||||
+ fprintf(stderr, " %c %s (%s)", used, info->name, info->ext);
|
||||
+ if (info->whatis)
|
||||
+ fprintf(stderr, "\t%s", info->whatis);
|
||||
+ fputc('\n', stderr);
|
||||
+ used = ' ';
|
||||
+ }
|
||||
+ fputs("Man: ", stderr);
|
||||
+ fputs(_("What manual page do you want?\n"), stderr);
|
||||
+ fputs("Man: ", stderr);
|
||||
+ fflush(stderr);
|
||||
+
|
||||
+ sigemptyset(&sa.sa_mask);
|
||||
+ sa.sa_flags = SA_RESETHAND;
|
||||
+ sa.sa_handler = handler;
|
||||
+
|
||||
+ sigaction(SIGALRM, &sa, (struct sigaction*)0);
|
||||
+
|
||||
+ alarm(7);
|
||||
+ len = read(STDIN_FILENO, reqsect, sizeof(reqsect)-1);
|
||||
+ alarm(0);
|
||||
+
|
||||
+ if (expired) {
|
||||
+ tcflush(STDIN_FILENO, TCIFLUSH);
|
||||
+ fputc('\n', stderr);
|
||||
+ fflush(stderr);
|
||||
+ len = 0;
|
||||
+ break;
|
||||
+ }
|
||||
+ if (len > 0) {
|
||||
+ char * end;
|
||||
+ if ((end = strchr(reqsect, '\n')))
|
||||
+ *end = '\0';
|
||||
+ reqsect[len] = '\0';
|
||||
+ len = (ssize_t)strlen(reqsect);
|
||||
+ for (candp = candidates; candp; candp = candp->next) {
|
||||
+ if (len == 0)
|
||||
+ break;
|
||||
+ if ((found = STREQ(reqsect, candp->source->ext)))
|
||||
+ break;
|
||||
+ }
|
||||
+ if (!found)
|
||||
+ len = 0;
|
||||
+ found = 0;
|
||||
+ }
|
||||
+ } while (0);
|
||||
+#endif
|
||||
+
|
||||
for (candp = candidates; candp; candp = candp->next) {
|
||||
+
|
||||
+#if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS > 1)
|
||||
+ if (len && !STREQ(reqsect, candp->source->ext))
|
||||
+ continue;
|
||||
+#endif
|
||||
+
|
||||
global_manpath = is_global_mandir (candp->path);
|
||||
if (!global_manpath)
|
||||
drop_effective_privs ();
|
||||
@@ -3235,9 +3331,51 @@ static int display_pages (struct candida
|
||||
regain_effective_privs ();
|
||||
|
||||
if (found && !findall)
|
||||
- return found;
|
||||
+ {
|
||||
+#if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS > 0)
|
||||
+ if (external)
|
||||
+ goto out;
|
||||
+ if ((troff + catman + (print_where || print_where_cat)))
|
||||
+ goto out;
|
||||
+# if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS == 1)
|
||||
+ if (getenv("MAN_POSIXLY_CORRECT"))
|
||||
+ goto out;
|
||||
+# endif
|
||||
+ if (!isatty(STDOUT_FILENO))
|
||||
+ goto out;
|
||||
+ if (!isatty(STDERR_FILENO))
|
||||
+ goto out;
|
||||
+ /*
|
||||
+ * Should be able to use the output as done by whatis(1)
|
||||
+ */
|
||||
+# if defined(PROMPT_IF_MULTIPLE_SECTIONS) && (PROMPT_IF_MULTIPLE_SECTIONS == 1)
|
||||
+ if (candp->next)
|
||||
+# else
|
||||
+ if (candp->next && getenv("MAN_POSIXLY_CORRECT"))
|
||||
+# endif
|
||||
+ {
|
||||
+ int used = 0x2A;
|
||||
+
|
||||
+ fputs("Man: ", stderr);
|
||||
+ fputs(_("find all matching manual pages"), stderr);
|
||||
+ fputc('\n', stderr);
|
||||
+
|
||||
+ do {
|
||||
+ struct mandata *info = candp->source;
|
||||
+ fprintf(stderr, " %c %s (%s)", used, info->name, info->ext);
|
||||
+ if (info->whatis) {
|
||||
+ fprintf(stderr, "\t%s", info->whatis);
|
||||
+ }
|
||||
+ fputc('\n', stderr);
|
||||
+ used = ' ';
|
||||
+ } while ((candp = candp->next));
|
||||
+ fflush(stderr);
|
||||
+ }
|
||||
+#endif
|
||||
+ goto out;
|
||||
+ }
|
||||
}
|
||||
-
|
||||
+out:
|
||||
return found;
|
||||
}
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 5 17:04:01 CEST 2008 - werner@suse.de
|
||||
|
||||
- Show the user if there are more than one manual page found for
|
||||
the stated item (fate#303433)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 13 15:22:58 CEST 2008 - werner@suse.de
|
||||
|
||||
|
7
man.spec
7
man.spec
@ -24,7 +24,7 @@ BuildRequires: gettext-runtime gettext-tools
|
||||
BuildRequires: gettext gettext-devel
|
||||
%endif
|
||||
Version: 2.5.1
|
||||
Release: 9
|
||||
Release: 14
|
||||
Summary: A Program for Displaying man Pages
|
||||
License: GPL v2 or later
|
||||
Url: https://savannah.nongnu.org/projects/man-db
|
||||
@ -47,6 +47,7 @@ Patch6: man-db-2.4.3-firefox.dif
|
||||
Patch7: man-db-%{version}-chinese.dif
|
||||
Patch8: man-db-%{version}-globbing.dif
|
||||
Patch9: man-db-%{version}-zio.dif
|
||||
Patch10: man-db-%{version}-listall.dif
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%global _sysconfdir /etc
|
||||
|
||||
@ -72,6 +73,7 @@ Authors:
|
||||
%patch7 -p0 -b .chinese
|
||||
%patch8 -p0 -b .globbing
|
||||
%patch9 -p0 -b .zio
|
||||
%patch10 -p0 -b .listall
|
||||
%patch -p0
|
||||
|
||||
%build
|
||||
@ -272,6 +274,9 @@ test -d var/catman/ && rm -rf var/catman/ || true
|
||||
%{_localstatedir}/adm/fillup-templates/sysconfig.cron-man
|
||||
|
||||
%changelog
|
||||
* Thu Jun 05 2008 werner@suse.de
|
||||
- Show the user if there are more than one manual page found for
|
||||
the stated item (fate#303433)
|
||||
* Tue May 13 2008 werner@suse.de
|
||||
- Avoid tab stops in section names
|
||||
* Wed Apr 23 2008 werner@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user