|
|
| version 1.2, 2003/06/17 04:25:46 | version 1.3, 2004/02/03 19:22:59 |
|---|---|
| Line 14 | Line 14 |
| * Austin, Texas 78712 | * Austin, Texas 78712 |
| * | * |
| * $FreeBSD: src/gnu/usr.bin/man/man/man.c,v 1.37.2.10 2003/02/14 15:38:51 ru Exp $ | * $FreeBSD: src/gnu/usr.bin/man/man/man.c,v 1.37.2.10 2003/02/14 15:38:51 ru Exp $ |
| * $DragonFly: src/gnu/usr.bin/man/man/man.c,v 1.1 2003/06/16 04:10:24 dillon Exp $ | * $DragonFly$ |
| */ | */ |
| #define MAN_MAIN | #define MAN_MAIN |
| Line 24 | Line 24 |
| #include <sys/param.h> | #include <sys/param.h> |
| #include <ctype.h> | #include <ctype.h> |
| #include <errno.h> | #include <errno.h> |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| #include <locale.h> | #include <locale.h> |
| #include <langinfo.h> | #include <langinfo.h> |
| #endif | #endif |
| Line 89 static int whatis; | Line 89 static int whatis; |
| static int findall; | static int findall; |
| static int print_where; | static int print_where; |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| static char *locale, *locale_opts, *locale_nroff, *locale_codeset; | static char *locale, *locale_opts, *locale_nroff, *locale_codeset; |
| static char locale_terr[3], locale_lang[3]; | static char locale_terr[3], locale_lang[3]; |
| static char *man_locale; | static char *man_locale; |
| Line 112 static int troff = 0; | Line 112 static int troff = 0; |
| int debug; | int debug; |
| #ifdef HAS_TROFF | #ifdef HAS_TROFF |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| static char args[] = "M:P:S:adfhkm:op:tw?"; | static char args[] = "M:P:S:adfhkm:op:tw?"; |
| #else | #else |
| static char args[] = "M:P:S:adfhkm:p:tw?"; | static char args[] = "M:P:S:adfhkm:p:tw?"; |
| #endif | #endif |
| #else | #else |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| static char args[] = "M:P:S:adfhkm:op:w?"; | static char args[] = "M:P:S:adfhkm:op:w?"; |
| #else | #else |
| static char args[] = "M:P:S:adfhkm:p:w?"; | static char args[] = "M:P:S:adfhkm:p:w?"; |
| Line 152 main (argc, argv) | Line 152 main (argc, argv) |
| longsec = NULL; | longsec = NULL; |
| unsetenv("IFS"); | unsetenv("IFS"); |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| (void) setlocale(LC_ALL, ""); | (void) setlocale(LC_ALL, ""); |
| #endif | #endif |
| man_getopt (argc, argv); | man_getopt (argc, argv); |
| Line 225 usage () | Line 225 usage () |
| static char usage_string[1024] = "%s, version %s\n\n"; | static char usage_string[1024] = "%s, version %s\n\n"; |
| #ifdef HAS_TROFF | #ifdef HAS_TROFF |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| static char s1[] = | static char s1[] = |
| "usage: %s [-adfhkotw] [section] [-M path] [-P pager] [-S list]\n\ | "usage: %s [-adfhkotw] [section] [-M path] [-P pager] [-S list]\n\ |
| [-m machine] [-p string] name ...\n\n"; | [-m machine] [-p string] name ...\n\n"; |
| Line 235 usage () | Line 235 usage () |
| [-m machine] [-p string] name ...\n\n"; | [-m machine] [-p string] name ...\n\n"; |
| #endif | #endif |
| #else | #else |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| static char s1[] = | static char s1[] = |
| "usage: %s [-adfhkow] [section] [-M path] [-P pager] [-S list]\n\ | "usage: %s [-adfhkow] [section] [-M path] [-P pager] [-S list]\n\ |
| [-m machine] [-p string] name ...\n\n"; | [-m machine] [-p string] name ...\n\n"; |
| Line 252 static char s2[] = " a : find all match | Line 252 static char s2[] = " a : find all match |
| h : print this help message\n\ | h : print this help message\n\ |
| k : same as apropos(1)\n"; | k : same as apropos(1)\n"; |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| static char s3[] = " o : use original, non-localized manpages\n"; | static char s3[] = " o : use original, non-localized manpages\n"; |
| #endif | #endif |
| Line 272 static char s2[] = " a : find all match | Line 272 static char s2[] = " a : find all match |
| strcat (usage_string, s1); | strcat (usage_string, s1); |
| strcat (usage_string, s2); | strcat (usage_string, s2); |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| strcat (usage_string, s3); | strcat (usage_string, s3); |
| #endif | #endif |
| Line 372 man_getopt (argc, argv) | Line 372 man_getopt (argc, argv) |
| case 'm': | case 'm': |
| machine = optarg; | machine = optarg; |
| break; | break; |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| case 'o': | case 'o': |
| use_original++; | use_original++; |
| break; | break; |
| Line 408 man_getopt (argc, argv) | Line 408 man_getopt (argc, argv) |
| } | } |
| } | } |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| /* "" intentionally used to catch error */ | /* "" intentionally used to catch error */ |
| if ((locale = setlocale(LC_CTYPE, "")) != NULL) | if ((locale = setlocale(LC_CTYPE, "")) != NULL) |
| locale_codeset = nl_langinfo(CODESET); | locale_codeset = nl_langinfo(CODESET); |
| Line 467 man_getopt (argc, argv) | Line 467 man_getopt (argc, argv) |
| } | } |
| } | } |
| } | } |
| #endif /* __FreeBSD__ */ | #endif /* __DragonFly__ */ |
| if (pager == NULL || *pager == '\0') | if (pager == NULL || *pager == '\0') |
| if ((pager = getenv ("PAGER")) == NULL || *pager == '\0') | if ((pager = getenv ("PAGER")) == NULL || *pager == '\0') |
| Line 959 parse_roff_directive (cp, file, buf, buf | Line 959 parse_roff_directive (cp, file, buf, buf |
| if (troff) | if (troff) |
| add_directive (&first, EQN, file, buf, bufsize); | add_directive (&first, EQN, file, buf, bufsize); |
| else { | else { |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| char lbuf[FILENAME_MAX]; | char lbuf[FILENAME_MAX]; |
| snprintf(lbuf, sizeof(lbuf), "%s -T%s", NEQN, | snprintf(lbuf, sizeof(lbuf), "%s -T%s", NEQN, |
| Line 1038 parse_roff_directive (cp, file, buf, buf | Line 1038 parse_roff_directive (cp, file, buf, buf |
| else | else |
| #endif | #endif |
| { | { |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| char lbuf[FILENAME_MAX]; | char lbuf[FILENAME_MAX]; |
| snprintf(lbuf, sizeof(lbuf), "%s -T%s%s%s", NROFF, | snprintf(lbuf, sizeof(lbuf), "%s -T%s%s%s", NROFF, |
| Line 1604 man (name) | Line 1604 man (name) |
| register int glob; | register int glob; |
| register char **mp; | register char **mp; |
| register char **sp; | register char **sp; |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| int l_found; | int l_found; |
| char buf[FILENAME_MAX]; | char buf[FILENAME_MAX]; |
| #endif | #endif |
| Line 1621 man (name) | Line 1621 man (name) |
| glob = 1; | glob = 1; |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| l_found = 0; | l_found = 0; |
| if (locale != NULL) { | if (locale != NULL) { |
| locale_opts = locale_nroff; | locale_opts = locale_nroff; |
| Line 1653 man (name) | Line 1653 man (name) |
| if (!l_found) { | if (!l_found) { |
| #endif | #endif |
| found += try_section (*mp, shortsec, longsec, name, glob); | found += try_section (*mp, shortsec, longsec, name, glob); |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| } else | } else |
| found += l_found; | found += l_found; |
| #endif | #endif |
| Line 1673 man (name) | Line 1673 man (name) |
| glob = 1; | glob = 1; |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| l_found = 0; | l_found = 0; |
| if (locale != NULL) { | if (locale != NULL) { |
| locale_opts = locale_nroff; | locale_opts = locale_nroff; |
| Line 1705 man (name) | Line 1705 man (name) |
| if (!l_found) { | if (!l_found) { |
| #endif | #endif |
| found += try_section (*mp, *sp, longsec, name, glob); | found += try_section (*mp, *sp, longsec, name, glob); |
| #ifdef __FreeBSD__ | #ifdef __DragonFly__ |
| } else | } else |
| found += l_found; | found += l_found; |
| #endif | #endif |