Annotation of src/usr.bin/man/man.c, Revision 1.2
1.2 ! deraadt 1: /* $OpenBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */
1.1 deraadt 2: /* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */
3:
4: /*
5: * Copyright (c) 1987, 1993, 1994, 1995
6: * The Regents of the University of California. All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the University of
19: * California, Berkeley and its contributors.
20: * 4. Neither the name of the University nor the names of its contributors
21: * may be used to endorse or promote products derived from this software
22: * without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34: * SUCH DAMAGE.
35: */
36:
37: #ifndef lint
38: static char copyright[] =
39: "@(#) Copyright (c) 1987, 1993, 1994, 1995\n\
40: The Regents of the University of California. All rights reserved.\n";
41: #endif /* not lint */
42:
43: #ifndef lint
44: #if 0
45: static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
46: #else
1.2 ! deraadt 47: static char rcsid[] = "$OpenBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $";
1.1 deraadt 48: #endif
49: #endif /* not lint */
50:
51: #include <sys/param.h>
52: #include <sys/queue.h>
53:
54: #include <ctype.h>
55: #include <err.h>
56: #include <errno.h>
57: #include <fcntl.h>
58: #include <fnmatch.h>
59: #include <glob.h>
60: #include <signal.h>
61: #include <stdio.h>
62: #include <stdlib.h>
63: #include <string.h>
64: #include <unistd.h>
65:
66: #include "config.h"
67: #include "pathnames.h"
68:
69: int f_all, f_where;
70:
71: static void build_page __P((char *, char **));
72: static void cat __P((char *));
73: static char *check_pager __P((char *));
74: static int cleanup __P((void));
75: static void how __P((char *));
76: static void jump __P((char **, char *, char *));
77: static int manual __P((char *, TAG *, glob_t *));
78: static void onsig __P((int));
79: static void usage __P((void));
80:
81: int
82: main(argc, argv)
83: int argc;
84: char *argv[];
85: {
86: extern char *optarg;
87: extern int optind;
88: TAG *defp, *defnewp, *section, *sectnewp, *subp;
89: ENTRY *e_defp, *e_sectp, *e_subp, *ep;
90: glob_t pg;
91: size_t len;
92: int ch, f_cat, f_how, found;
93: char **ap, *cmd, *machine, *p, *p_add, *p_path, *pager, *slashp;
94: char *conffile, buf[MAXPATHLEN * 2];
95:
96: f_cat = f_how = 0;
97: conffile = p_add = p_path = NULL;
98: while ((ch = getopt(argc, argv, "-aC:cfhkM:m:P:w")) != EOF)
99: switch (ch) {
100: case 'a':
101: f_all = 1;
102: break;
103: case 'C':
104: conffile = optarg;
105: break;
106: case 'c':
107: case '-': /* Deprecated. */
108: f_cat = 1;
109: break;
110: case 'h':
111: f_how = 1;
112: break;
113: case 'm':
114: p_add = optarg;
115: break;
116: case 'M':
117: case 'P': /* Backward compatibility. */
118: p_path = optarg;
119: break;
120: /*
121: * The -f and -k options are backward compatible,
122: * undocumented ways of calling whatis(1) and apropos(1).
123: */
124: case 'f':
125: jump(argv, "-f", "whatis");
126: /* NOTREACHED */
127: case 'k':
128: jump(argv, "-k", "apropos");
129: /* NOTREACHED */
130: case 'w':
131: f_all = f_where = 1;
132: break;
133: case '?':
134: default:
135: usage();
136: }
137: argc -= optind;
138: argv += optind;
139:
140: if (!*argv)
141: usage();
142:
143: if (!f_cat && !f_how && !f_where)
144: if (!isatty(1))
145: f_cat = 1;
146: else if ((pager = getenv("PAGER")) != NULL)
147: pager = check_pager(pager);
148: else
149: pager = _PATH_PAGER;
150:
151: /* Read the configuration file. */
152: config(conffile);
153:
154: /* Get the machine type. */
155: if ((machine = getenv("MACHINE")) == NULL)
156: machine = MACHINE;
157:
158: /* If there's no _default list, create an empty one. */
159: if ((defp = getlist("_default")) == NULL)
160: defp = addlist("_default");
161:
162: /*
163: * 1: If the user specified a MANPATH variable, or set the -M
164: * option, we replace the _default list with the user's list,
165: * appending the entries in the _subdir list and the machine.
166: */
167: if (p_path == NULL)
168: p_path = getenv("MANPATH");
169: if (p_path != NULL) {
170: while ((e_defp = defp->list.tqh_first) != NULL) {
171: free(e_defp->s);
172: TAILQ_REMOVE(&defp->list, e_defp, q);
173: }
174: for (p = strtok(p_path, ":");
175: p != NULL; p = strtok(NULL, ":")) {
176: slashp = p[strlen(p) - 1] == '/' ? "" : "/";
177: e_subp = (subp = getlist("_subdir")) == NULL ?
178: NULL : subp->list.tqh_first;
179: for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
180: (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
181: p, slashp, e_subp->s, machine);
182: if ((ep = malloc(sizeof(ENTRY))) == NULL ||
183: (ep->s = strdup(buf)) == NULL)
184: err(1, NULL);
185: TAILQ_INSERT_TAIL(&defp->list, ep, q);
186: }
187: }
188: }
189:
190: /*
191: * 2: If the user did not specify MANPATH, -M or a section, rewrite
192: * the _default list to include the _subdir list and the machine.
193: */
194: if (argv[1] == NULL)
195: section = NULL;
196: else if ((section = getlist(*argv)) != NULL)
197: ++argv;
198: if (p_path == NULL && section == NULL) {
199: defnewp = addlist("_default_new");
200: e_defp =
201: defp->list.tqh_first == NULL ? NULL : defp->list.tqh_first;
202: for (; e_defp != NULL; e_defp = e_defp->q.tqe_next) {
203: slashp =
204: e_defp->s[strlen(e_defp->s) - 1] == '/' ? "" : "/";
205: e_subp = (subp = getlist("_subdir")) == NULL ?
206: NULL : subp->list.tqh_first;
207: for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
208: (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
209: e_defp->s, slashp, e_subp->s, machine);
210: if ((ep = malloc(sizeof(ENTRY))) == NULL ||
211: (ep->s = strdup(buf)) == NULL)
212: err(1, NULL);
213: TAILQ_INSERT_TAIL(&defnewp->list, ep, q);
214: }
215: }
216: defp = getlist("_default");
217: while ((e_defp = defp->list.tqh_first) != NULL) {
218: free(e_defp->s);
219: TAILQ_REMOVE(&defp->list, e_defp, q);
220: }
221: free(defp->s);
222: TAILQ_REMOVE(&head, defp, q);
223: defnewp = getlist("_default_new");
224: free(defnewp->s);
225: defnewp->s = "_default";
226: defp = defnewp;
227: }
228:
229: /*
230: * 3: If the user set the -m option, insert the user's list before
231: * whatever list we have, again appending the _subdir list and
232: * the machine.
233: */
234: if (p_add != NULL)
235: for (p = strtok(p_add, ":"); p != NULL; p = strtok(NULL, ":")) {
236: slashp = p[strlen(p) - 1] == '/' ? "" : "/";
237: e_subp = (subp = getlist("_subdir")) == NULL ?
238: NULL : subp->list.tqh_first;
239: for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
240: (void)snprintf(buf, sizeof(buf), "%s%s%s{/%s,}",
241: p, slashp, e_subp->s, machine);
242: if ((ep = malloc(sizeof(ENTRY))) == NULL ||
243: (ep->s = strdup(buf)) == NULL)
244: err(1, NULL);
245: TAILQ_INSERT_HEAD(&defp->list, ep, q);
246: }
247: }
248:
249: /*
250: * 4: If no -m was specified, and a section was, rewrite the section's
251: * paths (if they have a trailing slash) to append the _subdir list
252: * and the machine. This then becomes the _default list.
253: */
254: if (p_add == NULL && section != NULL) {
255: sectnewp = addlist("_section_new");
256: for (e_sectp = section->list.tqh_first;
257: e_sectp != NULL; e_sectp = e_sectp->q.tqe_next) {
258: if (e_sectp->s[strlen(e_sectp->s) - 1] != '/') {
259: (void)snprintf(buf, sizeof(buf),
260: "%s{/%s,}", e_sectp->s, machine);
261: if ((ep = malloc(sizeof(ENTRY))) == NULL ||
262: (ep->s = strdup(buf)) == NULL)
263: err(1, NULL);
264: TAILQ_INSERT_TAIL(§newp->list, ep, q);
265: continue;
266: }
267: e_subp = (subp = getlist("_subdir")) == NULL ?
268: NULL : subp->list.tqh_first;
269: for (; e_subp != NULL; e_subp = e_subp->q.tqe_next) {
270: (void)snprintf(buf, sizeof(buf), "%s%s{/%s,}",
271: e_sectp->s, e_subp->s, machine);
272: if ((ep = malloc(sizeof(ENTRY))) == NULL ||
273: (ep->s = strdup(buf)) == NULL)
274: err(1, NULL);
275: TAILQ_INSERT_TAIL(§newp->list, ep, q);
276: }
277: }
278: sectnewp->s = section->s;
279: defp = sectnewp;
280: TAILQ_REMOVE(&head, section, q);
281: }
282:
283: /*
284: * 5: Search for the files. Set up an interrupt handler, so the
285: * temporary files go away.
286: */
287: (void)signal(SIGINT, onsig);
288: (void)signal(SIGHUP, onsig);
289:
290: memset(&pg, 0, sizeof(pg));
291: for (found = 0; *argv; ++argv)
292: if (manual(*argv, defp, &pg))
293: found = 1;
294:
295: /* 6: If nothing found, we're done. */
296: if (!found) {
297: (void)cleanup();
298: exit (1);
299: }
300:
301: /* 7: If it's simple, display it fast. */
302: if (f_cat) {
303: for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
304: if (**ap == '\0')
305: continue;
306: cat(*ap);
307: }
308: exit (cleanup());
309: }
310: if (f_how) {
311: for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
312: if (**ap == '\0')
313: continue;
314: how(*ap);
315: }
316: exit(cleanup());
317: }
318: if (f_where) {
319: for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
320: if (**ap == '\0')
321: continue;
322: (void)printf("%s\n", *ap);
323: }
324: exit(cleanup());
325: }
326:
327: /*
328: * 8: We display things in a single command; build a list of things
329: * to display.
330: */
331: for (ap = pg.gl_pathv, len = strlen(pager) + 1; *ap != NULL; ++ap) {
332: if (**ap == '\0')
333: continue;
334: len += strlen(*ap) + 1;
335: }
336: if ((cmd = malloc(len)) == NULL) {
337: warn(NULL);
338: (void)cleanup();
339: exit(1);
340: }
341: p = cmd;
342: len = strlen(pager);
343: memmove(p, pager, len);
344: p += len;
345: *p++ = ' ';
346: for (ap = pg.gl_pathv; *ap != NULL; ++ap) {
347: if (**ap == '\0')
348: continue;
349: len = strlen(*ap);
350: memmove(p, *ap, len);
351: p += len;
352: *p++ = ' ';
353: }
354: *p = '\0';
355:
356: /* Use system(3) in case someone's pager is "pager arg1 arg2". */
357: (void)system(cmd);
358:
359: exit(cleanup());
360: }
361:
362: /*
363: * manual --
364: * Search the manuals for the pages.
365: */
366: static int
367: manual(page, tag, pg)
368: char *page;
369: TAG *tag;
370: glob_t *pg;
371: {
372: ENTRY *ep, *e_sufp, *e_tag;
373: TAG *missp, *sufp;
374: int anyfound, cnt, found;
375: char *p, buf[128];
376:
377: anyfound = 0;
378: buf[0] = '*';
379:
380: /* For each element in the list... */
381: e_tag = tag == NULL ? NULL : tag->list.tqh_first;
382: for (; e_tag != NULL; e_tag = e_tag->q.tqe_next) {
383: (void)snprintf(buf, sizeof(buf), "%s/%s.*", e_tag->s, page);
384: if (glob(buf,
385: GLOB_APPEND | GLOB_BRACE | GLOB_NOSORT | GLOB_QUOTE,
386: NULL, pg)) {
387: warn("globbing");
388: (void)cleanup();
389: exit(1);
390: }
391: if (pg->gl_matchc == 0)
392: continue;
393:
394: /* Find out if it's really a man page. */
395: for (cnt = pg->gl_pathc - pg->gl_matchc;
396: cnt < pg->gl_pathc; ++cnt) {
397:
398: /*
399: * Try the _suffix key words first.
400: *
401: * XXX
402: * Older versions of man.conf didn't have the suffix
403: * key words, it was assumed that everything was a .0.
404: * We just test for .0 first, it's fast and probably
405: * going to hit.
406: */
407: (void)snprintf(buf, sizeof(buf), "*/%s.0", page);
408: if (!fnmatch(buf, pg->gl_pathv[cnt], 0))
409: goto next;
410:
411: e_sufp = (sufp = getlist("_suffix")) == NULL ?
412: NULL : sufp->list.tqh_first;
413: for (found = 0;
414: e_sufp != NULL; e_sufp = e_sufp->q.tqe_next) {
415: (void)snprintf(buf,
416: sizeof(buf), "*/%s%s", page, e_sufp->s);
417: if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
418: found = 1;
419: break;
420: }
421: }
422: if (found)
423: goto next;
424:
425: /* Try the _build key words next. */
426: e_sufp = (sufp = getlist("_build")) == NULL ?
427: NULL : sufp->list.tqh_first;
428: for (found = 0;
429: e_sufp != NULL; e_sufp = e_sufp->q.tqe_next) {
430: for (p = e_sufp->s;
431: *p != '\0' && !isspace(*p); ++p);
432: if (*p == '\0')
433: continue;
434: *p = '\0';
435: (void)snprintf(buf,
436: sizeof(buf), "*/%s%s", page, e_sufp->s);
437: if (!fnmatch(buf, pg->gl_pathv[cnt], 0)) {
438: if (!f_where)
439: build_page(p + 1,
440: &pg->gl_pathv[cnt]);
441: *p = ' ';
442: found = 1;
443: break;
444: }
445: *p = ' ';
446: }
447: if (found) {
448: next: anyfound = 1;
449: if (!f_all) {
450: /* Delete any other matches. */
451: while (++cnt< pg->gl_pathc)
452: pg->gl_pathv[cnt] = "";
453: break;
454: }
455: continue;
456: }
457:
458: /* It's not a man page, forget about it. */
459: pg->gl_pathv[cnt] = "";
460: }
461:
462: if (anyfound && !f_all)
463: break;
464: }
465:
466: /* If not found, enter onto the missing list. */
467: if (!anyfound) {
468: if ((missp = getlist("_missing")) == NULL)
469: missp = addlist("_missing");
470: if ((ep = malloc(sizeof(ENTRY))) == NULL ||
471: (ep->s = strdup(page)) == NULL) {
472: warn(NULL);
473: (void)cleanup();
474: exit(1);
475: }
476: TAILQ_INSERT_TAIL(&missp->list, ep, q);
477: }
478: return (anyfound);
479: }
480:
481: /*
482: * build_page --
483: * Build a man page for display.
484: */
485: static void
486: build_page(fmt, pathp)
487: char *fmt, **pathp;
488: {
489: static int warned;
490: ENTRY *ep;
491: TAG *intmpp;
492: int fd, n;
493: char *p, *b;
494: char buf[MAXPATHLEN], cmd[MAXPATHLEN], tpath[sizeof(_PATH_TMP)];
495:
496: /* Let the user know this may take awhile. */
497: if (!warned) {
498: warned = 1;
499: warnx("Formatting manual page...");
500: }
501:
502: /*
503: * Historically man chdir'd to the root of the man tree.
504: * This was used in man pages that contained relative ".so"
505: * directives (including other man pages for command aliases etc.)
506: * It even went one step farther, by examining the first line
507: * of the man page and parsing the .so filename so it would
508: * make hard(?) links to the cat'ted man pages for space savings.
509: * (We don't do that here, but we could).
510: */
511:
512: /* copy and find the end */
513: for (b = buf, p = *pathp; (*b++ = *p++) != '\0';)
514: continue;
515:
516: /* skip the last two path components, page name and man[n] */
517: for (--b, n = 2; b != buf; b--)
518: if (*b == '/')
519: if (--n == 0) {
520: *b = '\0';
521: (void) chdir(buf);
522: }
523:
524:
525: /* Add a remove-when-done list. */
526: if ((intmpp = getlist("_intmp")) == NULL)
527: intmpp = addlist("_intmp");
528:
529: /* Move to the printf(3) format string. */
530: for (; *fmt && isspace(*fmt); ++fmt);
531:
532: /*
533: * Get a temporary file and build a version of the file
534: * to display. Replace the old file name with the new one.
535: */
536: (void)strcpy(tpath, _PATH_TMP);
537: if ((fd = mkstemp(tpath)) == -1) {
538: warn("%s", tpath);
539: (void)cleanup();
540: exit(1);
541: }
542: (void)snprintf(buf, sizeof(buf), "%s > %s", fmt, tpath);
543: (void)snprintf(cmd, sizeof(cmd), buf, *pathp);
544: (void)system(cmd);
545: (void)close(fd);
546: if ((*pathp = strdup(tpath)) == NULL) {
547: warn(NULL);
548: (void)cleanup();
549: exit(1);
550: }
551:
552: /* Link the built file into the remove-when-done list. */
553: if ((ep = malloc(sizeof(ENTRY))) == NULL) {
554: warn(NULL);
555: (void)cleanup();
556: exit(1);
557: }
558: ep->s = *pathp;
559: TAILQ_INSERT_TAIL(&intmpp->list, ep, q);
560: }
561:
562: /*
563: * how --
564: * display how information
565: */
566: static void
567: how(fname)
568: char *fname;
569: {
570: FILE *fp;
571:
572: int lcnt, print;
573: char *p, buf[256];
574:
575: if (!(fp = fopen(fname, "r"))) {
576: warn("%s", fname);
577: (void)cleanup();
578: exit (1);
579: }
580: #define S1 "SYNOPSIS"
581: #define S2 "S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS"
582: #define D1 "DESCRIPTION"
583: #define D2 "D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN"
584: for (lcnt = print = 0; fgets(buf, sizeof(buf), fp);) {
585: if (!strncmp(buf, S1, sizeof(S1) - 1) ||
586: !strncmp(buf, S2, sizeof(S2) - 1)) {
587: print = 1;
588: continue;
589: } else if (!strncmp(buf, D1, sizeof(D1) - 1) ||
590: !strncmp(buf, D2, sizeof(D2) - 1))
591: return;
592: if (!print)
593: continue;
594: if (*buf == '\n')
595: ++lcnt;
596: else {
597: for(; lcnt; --lcnt)
598: (void)putchar('\n');
599: for (p = buf; isspace(*p); ++p);
600: (void)fputs(p, stdout);
601: }
602: }
603: (void)fclose(fp);
604: }
605:
606: /*
607: * cat --
608: * cat out the file
609: */
610: static void
611: cat(fname)
612: char *fname;
613: {
614: int fd, n;
615: char buf[2048];
616:
617: if ((fd = open(fname, O_RDONLY, 0)) < 0) {
618: warn("%s", fname);
619: (void)cleanup();
620: exit(1);
621: }
622: while ((n = read(fd, buf, sizeof(buf))) > 0)
623: if (write(STDOUT_FILENO, buf, n) != n) {
624: warn("write");
625: (void)cleanup();
626: exit (1);
627: }
628: if (n == -1) {
629: warn("read");
630: (void)cleanup();
631: exit(1);
632: }
633: (void)close(fd);
634: }
635:
636: /*
637: * check_pager --
638: * check the user supplied page information
639: */
640: static char *
641: check_pager(name)
642: char *name;
643: {
644: char *p, *save;
645:
646: /*
647: * if the user uses "more", we make it "more -s"; watch out for
648: * PAGER = "mypager /usr/ucb/more"
649: */
650: for (p = name; *p && !isspace(*p); ++p);
651: for (; p > name && *p != '/'; --p);
652: if (p != name)
653: ++p;
654:
655: /* make sure it's "more", not "morex" */
656: if (!strncmp(p, "more", 4) && (!p[4] || isspace(p[4]))){
657: save = name;
658: /* allocate space to add the "-s" */
659: if (!(name =
660: malloc((u_int)(strlen(save) + sizeof("-s") + 1))))
661: err(1, NULL);
662: (void)sprintf(name, "%s %s", save, "-s");
663: }
664: return(name);
665: }
666:
667: /*
668: * jump --
669: * strip out flag argument and jump
670: */
671: static void
672: jump(argv, flag, name)
673: char **argv, *flag, *name;
674: {
675: char **arg;
676:
677: argv[0] = name;
678: for (arg = argv + 1; *arg; ++arg)
679: if (!strcmp(*arg, flag))
680: break;
681: for (; *arg; ++arg)
682: arg[0] = arg[1];
683: execvp(name, argv);
684: (void)fprintf(stderr, "%s: Command not found.\n", name);
685: exit(1);
686: }
687:
688: /*
689: * onsig --
690: * If signaled, delete the temporary files.
691: */
692: static void
693: onsig(signo)
694: int signo;
695: {
696: (void)cleanup();
697:
698: (void)signal(signo, SIG_DFL);
699: (void)kill(getpid(), signo);
700:
701: /* NOTREACHED */
702: exit (1);
703: }
704:
705: /*
706: * cleanup --
707: * Clean up temporary files, show any error messages.
708: */
709: static int
710: cleanup()
711: {
712: TAG *intmpp, *missp;
713: ENTRY *ep;
714: int rval;
715:
716: rval = 0;
717: ep = (missp = getlist("_missing")) == NULL ?
718: NULL : missp->list.tqh_first;
719: if (ep != NULL)
720: for (; ep != NULL; ep = ep->q.tqe_next) {
721: warnx("no entry for %s in the manual.", ep->s);
722: rval = 1;
723: }
724:
725: ep = (intmpp = getlist("_intmp")) == NULL ?
726: NULL : intmpp->list.tqh_first;
727: for (; ep != NULL; ep = ep->q.tqe_next)
728: (void)unlink(ep->s);
729: return (rval);
730: }
731:
732: /*
733: * usage --
734: * print usage message and die
735: */
736: static void
737: usage()
738: {
739: (void)fprintf(stderr,
740: "usage: man [-achw] [-C file] [-M path] [-m path] [section] title ...\n");
741: exit(1);
742: }