3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T. */
26 /* All rights reserved. */
27
28 /*
29 * University Copyright- Copyright (c) 1982, 1986, 1988
30 * The Regents of the University of California
31 * All Rights Reserved
32 *
33 * University Acknowledgment- Portions of this document are derived from
34 * software developed by the University of California, Berkeley, and its
35 * contributors.
36 */
37
38
39 /*
40 * man
41 * links to apropos, whatis, and catman
42 * This version uses more for underlining and paging.
511 doargs:
512 subdirs = troffit ? troffdirs : nroffdirs;
513
514 init_bintoman();
515
516 if (manpath == NULL && (manpath = getenv("MANPATH")) == NULL) {
517 if ((manpath = getenv("PATH")) != NULL) {
518 bmp_flags = BMP_ISPATH | BMP_APPEND_MANDIR;
519 } else {
520 manpath = MANDIR;
521 }
522 }
523
524 pathv = split(manpath, ':');
525
526 manpage = build_manpath(pathv, bmp_flags);
527
528 /* release pathv allocated by split() */
529 freev(pathv);
530
531 fullpaths(&manpage);
532
533 if (catmando) {
534 catman(manpage, argv+optind, argc-optind);
535 exit(0);
536 }
537
538 /*
539 * The manual routine contains windows during which
540 * termination would leave a temp file behind. Thus
541 * we blanket the whole thing with a clean-up routine.
542 */
543 if (signal(SIGINT, SIG_IGN) == SIG_DFL) {
544 (void) signal(SIGINT, bye);
545 (void) signal(SIGQUIT, bye);
546 (void) signal(SIGTERM, bye);
547 }
548
549 /*
550 * "man -p" without operands
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012, Josef 'Jeff' Sipek <jeffpc@josefsipek.net>. All rights reserved.
24 */
25
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T. */
27 /* All rights reserved. */
28
29 /*
30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 * The Regents of the University of California
32 * All Rights Reserved
33 *
34 * University Acknowledgment- Portions of this document are derived from
35 * software developed by the University of California, Berkeley, and its
36 * contributors.
37 */
38
39
40 /*
41 * man
42 * links to apropos, whatis, and catman
43 * This version uses more for underlining and paging.
512 doargs:
513 subdirs = troffit ? troffdirs : nroffdirs;
514
515 init_bintoman();
516
517 if (manpath == NULL && (manpath = getenv("MANPATH")) == NULL) {
518 if ((manpath = getenv("PATH")) != NULL) {
519 bmp_flags = BMP_ISPATH | BMP_APPEND_MANDIR;
520 } else {
521 manpath = MANDIR;
522 }
523 }
524
525 pathv = split(manpath, ':');
526
527 manpage = build_manpath(pathv, bmp_flags);
528
529 /* release pathv allocated by split() */
530 freev(pathv);
531
532 /*
533 * Since we can't make use of GNU troff, set the path to ensure we
534 * find the one in /usr/bin first.
535 */
536 if (putenv("PATH=/usr/bin") != 0) {
537 perror("putenv");
538 exit(1);
539 }
540
541 fullpaths(&manpage);
542
543 if (catmando) {
544 catman(manpage, argv+optind, argc-optind);
545 exit(0);
546 }
547
548 /*
549 * The manual routine contains windows during which
550 * termination would leave a temp file behind. Thus
551 * we blanket the whole thing with a clean-up routine.
552 */
553 if (signal(SIGINT, SIG_IGN) == SIG_DFL) {
554 (void) signal(SIGINT, bye);
555 (void) signal(SIGQUIT, bye);
556 (void) signal(SIGTERM, bye);
557 }
558
559 /*
560 * "man -p" without operands
|