diff options
author | ache <ache@FreeBSD.org> | 1999-11-23 03:06:18 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1999-11-23 03:06:18 +0000 |
commit | 0ed5649adb63b2228e79134450f23bb4c6e02b52 (patch) | |
tree | 01ed5852064f317aed19559b87ab29d6e5671e42 | |
parent | 8d1b3af7b52b17cae8c93e38be9c5c762d16ee5e (diff) | |
download | FreeBSD-src-0ed5649adb63b2228e79134450f23bb4c6e02b52.zip FreeBSD-src-0ed5649adb63b2228e79134450f23bb4c6e02b52.tar.gz |
Add -L: print MANLOCALES variable for man locales list
-rw-r--r-- | gnu/usr.bin/man/manpath/manpath.c | 56 | ||||
-rw-r--r-- | gnu/usr.bin/man/manpath/manpath.config | 5 | ||||
-rw-r--r-- | gnu/usr.bin/man/manpath/manpath.man | 19 |
3 files changed, 75 insertions, 5 deletions
diff --git a/gnu/usr.bin/man/manpath/manpath.c b/gnu/usr.bin/man/manpath/manpath.c index 990805f..cb6fdfb 100644 --- a/gnu/usr.bin/man/manpath/manpath.c +++ b/gnu/usr.bin/man/manpath/manpath.c @@ -12,6 +12,8 @@ * Department of Chemical Engineering * The University of Texas at Austin * Austin, Texas 78712 + * + * $FreeBSD$ */ #define MANPATH_MAIN @@ -53,6 +55,8 @@ extern int fflush (); char *prognam; int debug; +int locale; +char *man_locales; /* * Examine user's PATH and print a reasonable MANPATH. @@ -74,13 +78,16 @@ main(argc, argv) prognam = mkprogname (argv[0]); - while ((c = getopt (argc, argv, "dhq?")) != EOF) + while ((c = getopt (argc, argv, "dhLq?")) != EOF) { switch (c) { case 'd': debug++; break; + case 'L': + locale++; + break; case 'q': quiet = 0; break; @@ -103,7 +110,7 @@ main(argc, argv) void usage () { - fprintf (stderr, "usage: %s [-q]\n", prognam); + fprintf (stderr, "usage: %s [-dLq]\n", prognam); exit (1); } #endif /* MAIN */ @@ -140,6 +147,20 @@ manpath (perrs) if (get_dirlist ()) gripe_reading_mp_config (config_file); + if (locale) + { + if ((manpathlist = getenv ("MANLOCALES")) != NULL) + /* + * This must be it. + */ + { + if (perrs) + fprintf (stderr, "(Warning: MANLOCALES environment variable set)\n"); + return strdup (manpathlist); + } + return (man_locales ? man_locales : ""); + } + if ((manpathlist = getenv ("MANPATH")) != NULL) /* * This must be it. @@ -258,6 +279,37 @@ get_dirlist () fprintf (stderr, "found manpath map %s --> %s\n", dlp->bin, dlp->mandir); } + else if (!strncmp ("MANLOCALES", bp, 10)) + { + if ((p = strchr (bp, ' ')) == NULL && + (p = strchr (bp, '\t')) == NULL) { + fclose(config); + return -1; + } + + bp = p; + + while (*bp && *bp != '\n' && (*bp == ' ' || *bp == '\t')) + bp++; + + for (p = bp; *p && *p != '\n'; p++) + ; + do { + *p-- = '\0'; + } while (p >= bp && (*p == ' ' || *p == '\t')); + + if (man_locales != NULL) + free (man_locales); + + if ((man_locales = strdup (bp)) == NULL) { + fclose(config); + return -1; + } + + if (debug) + fprintf (stderr, "found man locales: %s\n", + man_locales); + } else { gripe_reading_mp_config (config_file); diff --git a/gnu/usr.bin/man/manpath/manpath.config b/gnu/usr.bin/man/manpath/manpath.config index b340fea..79227c7 100644 --- a/gnu/usr.bin/man/manpath/manpath.config +++ b/gnu/usr.bin/man/manpath/manpath.config @@ -7,6 +7,7 @@ # MANDATORY_MANPATH manpath_element # OPTIONAL_MANPATH manpath_element # MANPATH_MAP path_element manpath_element +# MANLOCALES locale1 locale2 ... # # every automatically generated MANPATH includes these fields # @@ -23,3 +24,7 @@ MANPATH_MAP /bin /usr/share/man MANPATH_MAP /usr/bin /usr/share/man MANPATH_MAP /usr/local/bin /usr/local/man MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man +# +# set man locales, if needed +# +#MANLOCALES ru_RU.KOI8-R diff --git a/gnu/usr.bin/man/manpath/manpath.man b/gnu/usr.bin/man/manpath/manpath.man index 5b54a09..ba2b855 100644 --- a/gnu/usr.bin/man/manpath/manpath.man +++ b/gnu/usr.bin/man/manpath/manpath.man @@ -21,7 +21,7 @@ .Nd determine user's search path for man pages .Sh SYNOPSIS .Nm -.Op Fl q +.Op Fl dLq .Sh DESCRIPTION .Nm Manpath tries to determine the user's manpath from a set of system @@ -48,12 +48,16 @@ environment variable directly. .Pp The options are as follows: .Bl -tag -width Fl +.It Fl d +Output additional debug information. +.It Fl L +Output man locales list (if exist). .It Fl q Operate quietly. -Only echo the final manpath. +Only echo the final result. .El .Sh ENVIRONMENT -.Bl -tag -width MANPATH -compact +.Bl -tag -width MANLOCALES -compact .It Ev MANPATH If .Ev MANPATH @@ -61,6 +65,15 @@ is set, .Nm echoes its value on the standard output and issues a warning on the standard error. +.It Ev MANLOCALES +If +.Ev MANLOCALES +is set and +.Fl L +option is set, +.Nm +echoes its value on the standard output and issues a warning on the +standard error. .El .Sh FILES .Bl -tag -width %manpath_config_file% -compact |