*** man/man.c.orig Tue May 30 14:02:00 1995 --- man/man.c Sun Dec 8 03:33:04 1996 *************** *** 12,17 **** --- 12,19 ---- * Department of Chemical Engineering * The University of Texas at Austin * Austin, Texas 78712 + * + * (LOCALE enhancement by kumano@strl.nhk.or.jp, 1996) */ #define MAN_MAIN *************** *** 22,27 **** --- 24,32 ---- #include #include #include + #ifdef LOCALE + # include + #endif #include "config.h" #include "gripes.h" #include "version.h" *************** *** 112,117 **** --- 117,126 ---- uid_t egid; #endif + #ifdef LOCALE + static char current_locale[20]; + #endif + int main (argc, argv) int argc; *************** *** 129,134 **** --- 138,148 ---- void do_whatis (); int man (); + #ifdef LOCALE + (void)setlocale(LC_CTYPE, ""); + strcpy(current_locale, setlocale(LC_CTYPE, NULL)); + #endif + prognam = mkprogname (argv[0]); man_getopt (argc, argv); *************** *** 261,288 **** --- 275,345 ---- } char ** + #ifdef LOCALE + add_dir_to_mpath_list (mp, p, locale) + #else add_dir_to_mpath_list (mp, p) + #endif char **mp; char *p; + #ifdef LOCALE + int locale; + #endif { int status; + char *pp; + + #ifdef LOCALE + if (locale) + { + char buf[FILENAME_MAX]; + + strcpy (buf, p); + strcat (buf, "/"); + strcat (buf, current_locale); + + pp = buf; + } + else + { + pp = p; + } + status = is_directory (pp); + #else status = is_directory (p); + #endif if (status < 0 && debug) { + #ifdef LOCALE + fprintf (stderr, "Warning: couldn't stat file %s!\n", pp); + #else fprintf (stderr, "Warning: couldn't stat file %s!\n", p); + #endif } else if (status == 0 && debug) { + #ifdef LOCALE + fprintf (stderr, "Warning: %s isn't a directory!\n", pp); + #else fprintf (stderr, "Warning: %s isn't a directory!\n", p); + #endif } else if (status == 1) { if (debug) + #ifdef LOCALE + fprintf (stderr, "adding %s to manpathlist\n", pp); + #else fprintf (stderr, "adding %s to manpathlist\n", p); + #endif + #ifdef LOCALE + *mp++ = strdup (pp); + #else *mp++ = strdup (p); + #endif } return mp; } *************** *** 299,304 **** --- 356,364 ---- register char *p; register char *end; register char **mp; + #ifdef LOCALE + register int locale; + #endif extern char *optarg; extern int getopt (); extern void downcase (); *************** *** 409,414 **** --- 469,478 ---- * Expand the manpath into a list for easier handling. */ mp = manpathlist; + #ifdef LOCALE + for (locale = 1; locale >= 0; locale--) + { + #endif for (p = manp; ; p = end+1) { if ((end = strchr (p, ':')) != NULL) *************** *** 427,446 **** --- 491,525 ---- strcat (buf, "/"); strcat (buf, alt_system_name); + # ifdef LOCALE + mp = add_dir_to_mpath_list (mp, buf, locale); + # else mp = add_dir_to_mpath_list (mp, buf); + # endif } else { + # ifdef LOCALE + mp = add_dir_to_mpath_list (mp, p, locale); + # else mp = add_dir_to_mpath_list (mp, p); + # endif } #else + # ifdef LOCALE + mp = add_dir_to_mpath_list (mp, p, locale); + # else mp = add_dir_to_mpath_list (mp, p); + # endif #endif if (end == NULL) break; *end = ':'; } + #ifdef LOCALE + } + #endif *mp = NULL; } *** man/Makefile.orig Wed Dec 4 11:11:09 1996 --- man/Makefile Sun Dec 8 03:26:31 1996 *************** *** 9,14 **** --- 9,15 ---- .else LDADD= -L${.CURDIR}/../lib/ -lman .endif + LDADD+= -lxpg4 .if exists(${.CURDIR}/obj) MAN1= ${.CURDIR}/obj/jman.1 *************** *** 19,24 **** --- 20,26 ---- DPADD+= ${MAN1} CFLAGS+= -I${.CURDIR}/../lib -DSTDC_HEADERS -DPOSIX -DHAS_TROFF CFLAGS+= -DDO_COMPRESS -DALT_SYSTEMS -DSETREUID -DCATMODE=0664 + CFLAGS+= -DLOCALE CLEANFILES+= ${MAN1} ${MAN1}: ${.CURDIR}/man.man