-typedef struct {
- char *name, *msg;
-} DIR;
-static DIR list1[] = { /* section one list */
- "cat1", "1st", "cat8", "8th", "cat6", "6th",
- "cat.old", "old", NULL, NULL,
-}, list2[] = { /* rest of the list */
- "cat2", "2nd", "cat3", "3rd", "cat4", "4th",
- "cat5", "5th", "cat7", "7th", "cat3f", "3rd (F)",
- NULL, NULL,
-}, list3[2]; /* single section */
-
-/*
- * man --
- * main loop to find the manual page and print it out.
- */
-man(argv)
- char **argv;
-{
- DIR *section, *getsect();
- int res;
-
- for (; *argv; ++argv) {
- section = isdigit(**argv) ? getsect(*argv++) : NULL;
- if (*argv) {
- if (p_augment)
- if (section)
- res = manual(p_augment, section, *argv);
- else {
- res = manual(p_augment, list1, *argv);
- if (!res || f_all)
- res += manual(p_augment, list2,
- *argv);
- }
- if (p_path)
- if (section)
- res = manual(p_path, section, *argv);
- else {
- res = manual(p_path, list1, *argv);
- if (!res || f_all)
- res += manual(p_path, list2,
- *argv);
- }
- if (res || f_where)
- continue;
- (void)fprintf(stderr,
- "man: no entry for %s in the ", *argv);
- } else
- (void)fprintf(stderr,
- "man: what do you want from the ");
- if (section)
- (void)fprintf(stderr,
- "%s section of the ", section->msg);
- if (*argv)
- (void)fprintf(stderr, "manual.\n");
- else
- (void)fprintf(stderr, "manual?\n");
- exit(1);
- }
-}
-