mirror of
https://https.git.savannah.gnu.org/git/coreutils.git
synced 2026-01-27 01:44:21 +00:00
doc: support a configurable manual url
* configure.ac: Support ./configure --enable-manual-url=... * src/ls.c (oputs): Adjust accordingly.
This commit is contained in:
parent
deba7a673d
commit
5c6cb2b26b
20
configure.ac
20
configure.ac
@ -153,6 +153,26 @@ if test "$gl_bold_manpages" != no; then
|
||||
fi
|
||||
AM_CONDITIONAL([BOLD_MAN_REFS], [test "$gl_bold_manpages" != no])
|
||||
|
||||
AC_ARG_ENABLE([manual-url],
|
||||
[AS_HELP_STRING([--enable-manual-url@<:@=<url>@:>@],
|
||||
[When generating man pages, or displaying --help, generate hyperlinks
|
||||
from each "--option" to <url>@%:@command-option. A local file is
|
||||
supported through a file:// URL. The default URL used is:
|
||||
$PACKAGE_URL/manual/$PACKAGE.html.])],
|
||||
[case $enableval in
|
||||
yes) gl_manual_url=default ;;
|
||||
no) gl_manual_url='' ;;
|
||||
*) gl_manual_url="$enableval" ;;
|
||||
esac],
|
||||
[gl_manual_url=default]
|
||||
)
|
||||
if test x"$gl_manual_url" != x; then
|
||||
if test "$gl_manual_url" = default; then
|
||||
gl_manual_url=${PACKAGE_URL}manual/$PACKAGE.html
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([MANUAL_URL], ["$gl_manual_url"], [URL for full manual])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([gcc-warnings],
|
||||
[AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
|
||||
[control generation of GCC warnings. The TYPE 'no' disables
|
||||
|
||||
10
src/ls.c
10
src/ls.c
@ -5360,8 +5360,8 @@ oputs (char const *option)
|
||||
fwrite (option, 1, option_text - option, stdout);
|
||||
|
||||
/* write option text. */
|
||||
#ifdef MANUAL_URL
|
||||
char const *url_program = streq (PROGRAM_NAME, "[") ? "test" : PROGRAM_NAME;
|
||||
/* Note this can link to a local manual with file://... */
|
||||
/* Note single node manual doesn't work for ls, cksum, md5sum, sha*sum,
|
||||
but use single node for --help or --version.. */
|
||||
if (STREQ_LEN (option_text, "--help", 6)
|
||||
@ -5372,10 +5372,11 @@ oputs (char const *option)
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("\033]8;;%smanual/coreutils.html#%s%.*s", PACKAGE_URL,
|
||||
url_program, (int) anchor_len, option_text);
|
||||
printf ("\033]8;;%s#%s%.*s", MANUAL_URL, url_program,
|
||||
(int) anchor_len, option_text);
|
||||
}
|
||||
fputs ("\a", stdout);
|
||||
#endif
|
||||
#ifdef BOLD_MAN_REFS
|
||||
/* Note help2man strips this and will reinstate with --bold-refs. */
|
||||
fputs ("\033[1m", stdout);
|
||||
@ -5384,8 +5385,11 @@ oputs (char const *option)
|
||||
#ifdef BOLD_MAN_REFS
|
||||
fputs ("\033[0m", stdout);
|
||||
#endif
|
||||
#ifdef MANUAL_URL
|
||||
fputs ("\033]8;;\a", stdout);
|
||||
#endif
|
||||
|
||||
/* write description. */
|
||||
fputs (desc_text, stdout);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user