From 1c9a001641c07e5c2fe10e5de9da00f7d0d1ce79 Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Tue, 14 Feb 2017 15:59:53 +0200 Subject: [PATCH] use mandoc as manual viewer apropos(1) and whatis(1) don't work yet due to no database support. --- bin/mandoc/Makefile | 9 +- bin/mandoc/apropos.1 | 485 ++++++++ bin/mandoc/compat_reallocarray.c | 49 - bin/mandoc/config.h | 42 +- bin/mandoc/{eqn.5 => eqn.7} | 22 +- bin/mandoc/man.1 | 427 +++++++ bin/mandoc/man.7 | 928 +++++++++++++++ bin/mandoc/man.conf.5 | 131 +++ bin/mandoc/mandoc.1 | 191 ++-- bin/mandoc/{mandoc_char.5 => mandoc_char.7} | 34 +- bin/mandoc/{mdoc.5 => mdoc.7} | 289 ++--- bin/mandoc/{mandoc_roff.5 => roff.7} | 86 +- bin/mandoc/{tbl.5 => tbl.7} | 42 +- exception_lists/packaging | 6 - share/man/man1/Makefile | 3 - share/man/man1/apropos.1 | 130 --- share/man/man1/man.1 | 422 ------- share/man/man1m/Makefile | 1 - share/man/man1m/catman.1m | 72 -- share/man/man5/Makefile | 1 - share/man/man5/man.5 | 255 ----- usr/src/Targetdirs | 2 - usr/src/cmd/Makefile | 2 - usr/src/cmd/man/Makefile | 45 - usr/src/cmd/man/THIRDPARTYLICENSE | 92 -- usr/src/cmd/man/THIRDPARTYLICENSE.descrip | 1 - usr/src/cmd/man/makewhatis.c | 837 -------------- usr/src/cmd/man/man.c | 1619 --------------------------- usr/src/cmd/man/man.h | 39 - usr/src/cmd/man/stringlist.c | 102 -- usr/src/cmd/man/stringlist.h | 52 - usr/src/pkg/manifests/system-man.mf | 86 +- 32 files changed, 2351 insertions(+), 4151 deletions(-) create mode 100644 bin/mandoc/apropos.1 delete mode 100644 bin/mandoc/compat_reallocarray.c rename bin/mandoc/{eqn.5 => eqn.7} (98%) create mode 100644 bin/mandoc/man.1 create mode 100644 bin/mandoc/man.7 create mode 100644 bin/mandoc/man.conf.5 rename bin/mandoc/{mandoc_char.5 => mandoc_char.7} (99%) rename bin/mandoc/{mdoc.5 => mdoc.7} (90%) rename bin/mandoc/{mandoc_roff.5 => roff.7} (98%) rename bin/mandoc/{tbl.5 => tbl.7} (96%) delete mode 100644 share/man/man1/apropos.1 delete mode 100644 share/man/man1/man.1 delete mode 100644 share/man/man1m/catman.1m delete mode 100644 share/man/man5/man.5 delete mode 100644 usr/src/cmd/man/Makefile delete mode 100644 usr/src/cmd/man/THIRDPARTYLICENSE delete mode 100644 usr/src/cmd/man/THIRDPARTYLICENSE.descrip delete mode 100644 usr/src/cmd/man/makewhatis.c delete mode 100644 usr/src/cmd/man/man.c delete mode 100644 usr/src/cmd/man/man.h delete mode 100644 usr/src/cmd/man/stringlist.c delete mode 100644 usr/src/cmd/man/stringlist.h rewrite usr/src/pkg/manifests/system-man.mf (85%) diff --git a/bin/mandoc/Makefile b/bin/mandoc/Makefile index a7097b24c9..f3d5e4f2ad 100644 --- a/bin/mandoc/Makefile +++ b/bin/mandoc/Makefile @@ -14,12 +14,17 @@ SRCS+= manpath.c SRCS+= lib.c compat_ohash.c compat_strtonum.c LDADD+= -lz -CPPFLAGS+= -DOSNAME='"illumos"' +CPPFLAGS+= -DOSNAME='"unleashed"' CFLAGS+= -std=gnu99 # FIXME shouldn't need these hacks CPPFLAGS+= -D_TS_ERRNO -I/usr/include -MAN= mandoc.1 eqn.5 mandoc_char.5 mandoc_roff.5 mdoc.5 tbl.5 +MAN= apropos.1 man.1 mandoc.1 man.conf.5 eqn.7 man.7 mandoc_char.7 mdoc.7 \ + roff.7 tbl.7 +LINKS= ${BINDIR}/mandoc ${BINDIR}/apropos \ + ${BINDIR}/mandoc ${BINDIR}/man \ + ${BINDIR}/mandoc ${BINDIR}/whatis +MLINKS= apropos.1 whatis.1 .include diff --git a/bin/mandoc/apropos.1 b/bin/mandoc/apropos.1 new file mode 100644 index 0000000000..10ba3c6a45 --- /dev/null +++ b/bin/mandoc/apropos.1 @@ -0,0 +1,485 @@ +.\" $Id: apropos.1,v 1.39 2015/04/03 08:46:17 schwarze Exp $ +.\" +.\" Copyright (c) 2011, 2012 Kristaps Dzonsons +.\" Copyright (c) 2011, 2012, 2014 Ingo Schwarze +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: April 3 2015 $ +.Dt APROPOS 1 +.Os +.Sh NAME +.Nm apropos , +.Nm whatis +.Nd search manual page databases +.Sh SYNOPSIS +.Nm +.Op Fl acfhklw +.Op Fl C Ar file +.Op Fl M Ar path +.Op Fl m Ar path +.Op Fl O Ar outkey +.Op Fl S Ar arch +.Op Fl s Ar section +.Ar expression ... +.Sh DESCRIPTION +The +.Nm apropos +and +.Nm whatis +utilities query manual page databases generated by +.Xr makewhatis 8 , +evaluating +.Ar expression +for each file in each database. +By default, they display the names, section numbers, and description lines +of all matching manuals. +.Pp +By default, +.Nm +searches for +.Xr makewhatis 8 +databases in the default paths stipulated by +.Xr man 1 +and uses case-insensitive substring matching +.Pq the Cm = No operator +over manual names and descriptions +.Pq the Li \&Nm No and Li \&Nd No macro keys . +Multiple terms imply pairwise +.Fl o . +.Pp +.Nm whatis +is a synonym for +.Nm +.Fl f . +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl a +Instead of showing only the title lines, show the complete manual pages, +just like +.Xr man 1 +.Fl a +would. +If the standard output is a terminal device and +.Fl c +is not specified, use +.Xr more 1 +to paginate them. +In +.Fl a +mode, the options +.Fl IKOTW +described in the +.Xr mandoc 1 +manual are also available. +.It Fl C Ar file +Specify an alternative configuration +.Ar file +in +.Xr man.conf 5 +format. +.It Fl c +In +.Fl a +mode, copy the formatted manual pages to the standard output without using +.Xr more 1 +to paginate them. +.It Fl f +Search for all words in +.Ar expression +in manual page names only. +The search is case insensitive and matches whole words only. +In this mode, macro keys, comparison operators, and logical operators +are not available. +This overrides any earlier +.Fl k +and +.Fl l +options. +.It Fl h +Instead of showing the title lines, show the SYNOPSIS sections, just like +.Xr man 1 +.Fl h +would. +.It Fl k +Support the full +.Ar expression +syntax. +This overrides any earlier +.Fl f +and +.Fl l +options. +It is the default for +.Nm . +.It Fl l +An alias for +.Xr mandoc 1 +.Fl a . +This overrides any earlier +.Fl f , +.Fl k , +and +.Fl w +options. +.It Fl M Ar path +Use the colon-separated path instead of the default list of paths +searched for +.Xr makewhatis 8 +databases. +Invalid paths, or paths without manual databases, are ignored. +.It Fl m Ar path +Prepend the colon-separated paths to the list of paths searched +for +.Xr makewhatis 8 +databases. +Invalid paths, or paths without manual databases, are ignored. +.It Fl O Ar outkey +Show the values associated with the key +.Ar outkey +instead of the manual descriptions. +.It Fl S Ar arch +Restrict the search to pages for the specified +.Xr machine 1 +architecture. +.Ar arch +is case insensitive. +By default, pages for all architectures are shown. +.It Fl s Ar section +Restrict the search to the specified section of the manual. +By default, pages from all sections are shown. +See +.Xr man 1 +for a listing of sections. +.It Fl w +Instead of showing title lines, show the pathnames of the matching +manual pages, just like +.Xr man 1 +.Fl w +would. +.El +.Pp +An +.Ar expression +consists of search terms joined by logical operators +.Fl a +.Pq and +and +.Fl o +.Pq or . +The +.Fl a +operator has precedence over +.Fl o +and both are evaluated left-to-right. +.Bl -tag -width Ds +.It \&( Ar expr No \&) +True if the subexpression +.Ar expr +is true. +.It Ar expr1 Fl a Ar expr2 +True if both +.Ar expr1 +and +.Ar expr2 +are true (logical +.Sq and ) . +.It Ar expr1 Oo Fl o Oc Ar expr2 +True if +.Ar expr1 +and/or +.Ar expr2 +evaluate to true (logical +.Sq or ) . +.It Ar term +True if +.Ar term +is satisfied. +This has syntax +.Sm off +.Oo +.Op Ar key Op , Ar key ... +.Pq Cm = | \(ti +.Oc +.Ar val , +.Sm on +where +.Ar key +is an +.Xr mdoc 7 +macro to query and +.Ar val +is its value. +See +.Sx Macro Keys +for a list of available keys. +Operator +.Cm = +evaluates a substring, while +.Cm \(ti +evaluates a regular expression. +.It Fl i Ar term +If +.Ar term +is a regular expression, it +is evaluated case-insensitively. +Has no effect on substring terms. +.El +.Pp +Results are sorted by manual sections and names, with output formatted as +.Pp +.D1 name[, name...](sec) \- description +.Pp +Where +.Dq name +is the manual's name, +.Dq sec +is the manual section, and +.Dq description +is the manual's short description. +If an architecture is specified for the manual, it is displayed as +.Pp +.D1 name(sec/arch) \- description +.Pp +Resulting manuals may be accessed as +.Pp +.Dl $ man \-s sec name +.Pp +If an architecture is specified in the output, use +.Pp +.Dl $ man \-s sec \-S arch name +.Ss Macro Keys +Queries evaluate over a subset of +.Xr mdoc 7 +macros indexed by +.Xr makewhatis 8 . +In addition to the macro keys listed below, the special key +.Cm any +may be used to match any available macro key. +.Pp +Names and description: +.Bl -column "xLix" description -offset indent -compact +.It Li \&Nm Ta manual name +.It Li \&Nd Ta one-line manual description +.It Li arch Ta machine architecture (case-insensitive) +.It Li sec Ta manual section number +.El +.Pp +Sections and cross references: +.Bl -column "xLix" description -offset indent -compact +.It Li \&Sh Ta section header (excluding standard sections) +.It Li \&Ss Ta subsection header +.It Li \&Xr Ta cross reference to another manual page +.It Li \&Rs Ta bibliographic reference +.El +.Pp +Semantic markup for command line utilities: +.Bl -column "xLix" description -offset indent -compact +.It Li \&Fl Ta command line options (flags) +.It Li \&Cm Ta command modifier +.It Li \&Ar Ta command argument +.It Li \&Ic Ta internal or interactive command +.It Li \&Ev Ta environmental variable +.It Li \&Pa Ta file system path +.El +.Pp +Semantic markup for function libraries: +.Bl -column "xLix" description -offset indent -compact +.It Li \&Lb Ta function library name +.It Li \&In Ta include file +.It Li \&Ft Ta function return type +.It Li \&Fn Ta function name +.It Li \&Fa Ta function argument type and name +.It Li \&Vt Ta variable type +.It Li \&Va Ta variable name +.It Li \&Dv Ta defined variable or preprocessor constant +.It Li \&Er Ta error constant +.It Li \&Ev Ta environmental variable +.El +.Pp +Various semantic markup: +.Bl -column "xLix" description -offset indent -compact +.It Li \&An Ta author name +.It Li \&Lk Ta hyperlink +.It Li \&Mt Ta Do mailto Dc hyperlink +.It Li \&Cd Ta kernel configuration declaration +.It Li \&Ms Ta mathematical symbol +.It Li \&Tn Ta tradename +.El +.Pp +Physical markup: +.Bl -column "xLix" description -offset indent -compact +.It Li \&Em Ta italic font or underline +.It Li \&Sy Ta boldface font +.It Li \&Li Ta typewriter font +.El +.Pp +Text production: +.Bl -column "xLix" description -offset indent -compact +.It Li \&St Ta reference to a standards document +.It Li \&At Ta At No version reference +.It Li \&Bx Ta Bx No version reference +.It Li \&Bsx Ta Bsx No version reference +.It Li \&Nx Ta Nx No version reference +.It Li \&Fx Ta Fx No version reference +.It Li \&Ox Ta Ox No version reference +.It Li \&Dx Ta Dx No version reference +.El +.Sh ENVIRONMENT +.Bl -tag -width MANPAGER +.It Ev MANPAGER +Any non-empty value of the environment variable +.Ev MANPAGER +will be used instead of the standard pagination program, +.Xr more 1 . +.It Ev MANPATH +The standard search path used by +.Xr man 1 +may be changed by specifying a path in the +.Ev MANPATH +environment variable. +Invalid paths, or paths without manual databases, are ignored. +Overridden by +.Fl M . +If +.Ev MANPATH +begins with a colon, it is appended to the default list; +if it ends with a colon, it is prepended to the default list; +or if it contains two adjacent colons, +the standard search path is inserted between the colons. +If none of these conditions are met, it overrides the +standard search path. +.It Ev PAGER +Specifies the pagination program to use when +.Ev MANPAGER +is not defined. +If neither PAGER nor MANPAGER is defined, +.Xr more 1 +.Fl s +will be used. +.El +.Sh FILES +.Bl -tag -width "/etc/man.conf" -compact +.It Pa mandoc.db +name of the +.Xr makewhatis 8 +keyword database +.It Pa /etc/man.conf +default +.Xr man 1 +configuration file +.El +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Search for +.Qq .cf +as a substring of manual names and descriptions: +.Pp +.Dl $ apropos .cf +.Pp +Include matches for +.Qq .cnf +and +.Qq .conf +as well: +.Pp +.Dl $ apropos .cf .cnf .conf +.Pp +Search in names and descriptions using a regular expression: +.Pp +.Dl $ apropos \(aq\(tiset.?[ug]id\(aq +.Pp +Search for manuals in the library section mentioning both the +.Qq optind +and the +.Qq optarg +variables: +.Pp +.Dl $ apropos \-s 3 Va=optind \-a Va=optarg +.Pp +Do exactly the same as calling +.Xr whatis 1 +with the argument +.Qq ssh : +.Pp +.Dl $ apropos \-\- \-i \(aqNm\(ti[[:<:]]ssh[[:>:]]\(aq +.Pp +The following two invocations are equivalent: +.Pp +.D1 Li $ apropos -S Ar arch Li -s Ar section expression +.Bd -ragged -offset indent +.Li $ apropos \e( Ar expression Li \e) +.Li -a arch\(ti^( Ns Ar arch Ns Li |any)$ +.Li -a sec\(ti^ Ns Ar section Ns Li $ +.Ed +.Sh SEE ALSO +.Xr man 1 , +.Xr re_format 7 , +.Xr makewhatis 8 +.Sh HISTORY +Part of the functionality of +.Nm whatis +was already provided by the former +.Nm manwhere +utility in +.Bx 1 . +The +.Nm +and +.Nm whatis +utilities first appeared in +.Bx 2 . +They were rewritten from scratch for +.Ox 5.6 . +.Pp +The +.Fl M +option and the +.Ev MANPATH +variable first appeared in +.Bx 4.3 ; +.Fl m +in +.Bx 4.3 Reno ; +.Fl C +in +.Bx 4.4 Lite1 ; +and +.Fl S +and +.Fl s +in +.Ox 4.5 +for +.Nm +and in +.Ox 5.6 +for +.Nm whatis . +.Sh AUTHORS +.An -nosplit +.An Bill Joy +wrote +.Nm manwhere +in 1977 and the original +.Bx +.Nm +and +.Nm whatis +in February 1979. +The current version was written by +.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv +and +.An Ingo Schwarze Aq Mt schwarze@openbsd.org . diff --git a/bin/mandoc/compat_reallocarray.c b/bin/mandoc/compat_reallocarray.c deleted file mode 100644 index 6615190425..0000000000 --- a/bin/mandoc/compat_reallocarray.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "config.h" - -#if HAVE_REALLOCARRAY - -int dummy; - -#else - -/* $Id: compat_reallocarray.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */ -/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */ -/* - * Copyright (c) 2008 Otto Moerbeek - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include -#include -#include -#include - -/* - * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX - * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW - */ -#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) - -void * -reallocarray(void *optr, size_t nmemb, size_t size) -{ - if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && - nmemb > 0 && SIZE_MAX / nmemb < size) { - errno = ENOMEM; - return NULL; - } - return realloc(optr, size * nmemb); -} - -#endif /*!HAVE_REALLOCARRAY*/ diff --git a/bin/mandoc/config.h b/bin/mandoc/config.h index a9106ae4f4..be672aa767 100644 --- a/bin/mandoc/config.h +++ b/bin/mandoc/config.h @@ -1,28 +1,44 @@ +#ifdef __cplusplus +#error "Do not use C++. See the INSTALL file." +#endif + #ifndef MANDOC_CONFIG_H #define MANDOC_CONFIG_H -#include -#include - -#define HAVE_ERR 1 -#define HAVE_MANPATH 1 +#define MAN_CONF_FILE "/etc/man.conf" +#define MANPATH_DEFAULT "/usr/share/man:/usr/local/man" +#define HAVE_DIRENT_NAMLEN 0 +#define HAVE_ERR 1 +#define HAVE_FTS 1 +#define HAVE_GETLINE 1 +#define HAVE_GETSUBOPT 1 +#define HAVE_ISBLANK 1 +#define HAVE_MKDTEMP 1 #define HAVE_MMAP 1 -#define HAVE_OHASH 0 -#define HAVE_PLEDGE 0 -#define HAVE_PROGNAME 1 -#define HAVE_REALLOCARRAY 0 -#define HAVE_SANDBOX_INIT 0 -#define HAVE_SQLITE3 0 +#define HAVE_PLEDGE 0 +#define HAVE_PROGNAME 1 +#define HAVE_REALLOCARRAY 1 +#define HAVE_REWB_BSD 1 +#define HAVE_REWB_SYSV 1 +#define HAVE_SANDBOX_INIT 0 +#define HAVE_STRCASESTR 1 +#define HAVE_STRINGLIST 0 +#define HAVE_STRLCAT 1 +#define HAVE_STRLCPY 1 #define HAVE_STRPTIME 1 +#define HAVE_STRSEP 1 #define HAVE_STRTONUM 0 +#define HAVE_VASPRINTF 1 #define HAVE_WCHAR 1 +#define HAVE_SQLITE3 0 +#define HAVE_OHASH 0 +#define HAVE_MANPATH 0 #define BINM_APROPOS "apropos" +#define BINM_MAKEWHATIS "makewhatis" #define BINM_MAN "man" #define BINM_WHATIS "whatis" -#define BINM_MAKEWHATIS "man -w" -extern void *reallocarray(void *, size_t, size_t); extern long long strtonum(const char *, long long, long long, const char **); #endif /* MANDOC_CONFIG_H */ diff --git a/bin/mandoc/eqn.5 b/bin/mandoc/eqn.7 similarity index 98% rename from bin/mandoc/eqn.5 rename to bin/mandoc/eqn.7 index 5fcf9ec3ea..e3aad72e3a 100644 --- a/bin/mandoc/eqn.5 +++ b/bin/mandoc/eqn.7 @@ -16,7 +16,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: March 30 2015 $ -.Dt EQN 5 +.Dt EQN 7 .Os .Sh NAME .Nm eqn @@ -26,9 +26,9 @@ The .Nm eqn language is an equation-formatting language. It is used within -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 .Ux manual pages. It describes the @@ -45,9 +45,9 @@ specification (see for references). .Pp Equations within -.Xr mdoc 5 +.Xr mdoc 7 or -.Xr man 5 +.Xr man 7 documents are enclosed by the standalone .Sq \&.EQ and @@ -63,7 +63,7 @@ and strings. .Em Note : these are not the same as -.Xr mandoc_roff 5 +.Xr roff 7 macros, and may only be invoked as .Sq \&.EQ . .Pp @@ -129,7 +129,7 @@ partial (partial differential), inf (infinity), >> (much greater), << (not equal), == (equivalence), <= (less-than-equal), and >= (more-than-equal). The character escape sequences documented in -.Xr mandoc_char 5 +.Xr mandoc_char 7 can be used, too. .Pp The following control statements are available: @@ -460,10 +460,10 @@ commands are also ignored. .El .Sh SEE ALSO .Xr mandoc 1 , -.Xr man 5 , -.Xr mandoc_char 5 , -.Xr mandoc_roff 5 , -.Xr mdoc 5 +.Xr man 7 , +.Xr mandoc_char 7 , +.Xr mdoc 7 , +.Xr roff 7 .Rs .%A Brian W. Kernighan .%A Lorinda L. Cherry diff --git a/bin/mandoc/man.1 b/bin/mandoc/man.1 new file mode 100644 index 0000000000..0a7ae6d904 --- /dev/null +++ b/bin/mandoc/man.1 @@ -0,0 +1,427 @@ +.\" $Id: man.1,v 1.17 2016/07/01 20:24:04 schwarze Exp $ +.\" +.\" Copyright (c) 1989, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" Copyright (c) 2003, 2007, 2008, 2014 Jason McIntyre +.\" Copyright (c) 2010, 2011, 2014, 2015 Ingo Schwarze +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)man.1 8.2 (Berkeley) 1/2/94 +.\" +.Dd $Mdocdate: July 1 2016 $ +.Dt MAN 1 +.Os +.Sh NAME +.Nm man +.Nd display manual pages +.Sh SYNOPSIS +.Nm man +.Op Fl acfhklw +.Op Fl C Ar file +.Op Fl I Cm os Ns = Ns Ar name +.Op Fl K Ar encoding +.Op Fl M Ar path +.Op Fl m Ar path +.Op Fl O Ar option Ns = Ns Ar value +.Op Fl S Ar subsection +.Op Fl s Ar section +.Op Fl T Ar output +.Op Fl W Ar level +.Op Ar section +.Ar name ... +.Sh DESCRIPTION +The +.Nm +utility +displays the +manual pages entitled +.Ar name . +Pages may be selected according to +a specific category +.Pq Ar section +or +machine architecture +.Pq Ar subsection . +.Pp +The options are as follows: +.Bl -tag -width Ds +.It Fl a +Display all of the manual pages for a specified +.Ar section +and +.Ar name +combination. +Normally, only the first manual page found is displayed. +.It Fl C Ar file +Use the specified +.Ar file +instead of the default configuration file. +This permits users to configure their own manual environment. +See +.Xr man.conf 5 +for a description of the contents of this file. +.It Fl c +Copy the manual page to the standard output instead of using +.Xr more 1 +to paginate it. +This is done by default if the standard output is not a terminal device. +.It Fl f +A synonym for +.Xr whatis 1 . +It searches for +.Ar name +in manual page names and displays the header lines from all matching pages. +The search is case insensitive and matches whole words only. +This overrides any earlier +.Fl k +and +.Fl l +options. +.It Fl I Cm os Ns = Ns Ar name +Override the default operating system +.Ar name +for the +.Xr mdoc 7 +.Ic \&Os +and for the +.Xr man 7 +.Ic \&TH +macro. +.It Fl h +Display only the SYNOPSIS lines of the requested manual pages. +Implies +.Fl a +and +.Fl c . +.It Fl K Ar encoding +Specify the input encoding. +The supported +.Ar encoding +arguments are +.Cm us-ascii , +.Cm iso-8859-1 , +and +.Cm utf-8 . +By default, the encoding is automatically detected as described in the +.Xr mandoc 1 +manual. +.It Fl k +A synonym for +.Xr apropos 1 . +Instead of +.Ar name , +an expression can be provided using the syntax described in the +.Xr apropos 1 +manual. +By default, it displays the header lines of all matching pages. +This overrides any earlier +.Fl f +and +.Fl l +options. +.It Fl l +A synonym for +.Xr mandoc 1 +.Fl a . +The +.Ar name +arguments are interpreted as filenames. +No search is done and +.Ar file , +.Ar path , +.Ar section , +and +.Ar subsection +are ignored. +This overrides any earlier +.Fl f , +.Fl k , +and +.Fl w +options. +.It Fl M Ar path +Override the list of standard directories which +.Nm +searches for manual pages. +The supplied +.Ar path +must be a colon +.Pq Ql \&: +separated list of directories. +This search path may also be set using the environment variable +.Ev MANPATH . +.It Fl m Ar path +Augment the list of standard directories which +.Nm +searches for manual pages. +The supplied +.Ar path +must be a colon +.Pq Ql \&: +separated list of directories. +These directories will be searched before the standard directories or +the directories specified using the +.Fl M +option or the +.Ev MANPATH +environment variable. +.It Fl O Ar option Ns = Ns Ar value +Comma-separated output options. +For each output format, the available options are described in the +.Xr mandoc 1 +manual. +.It Fl S Ar subsection +Restricts the directories that +.Nm +will search to those of a specific +.Xr machine 1 +architecture. +.Ar subsection +is case insensitive. +.Pp +By default manual pages for all architectures are installed. +Therefore this option can be used to view pages for one +architecture whilst using another. +.Pp +This option overrides the +.Ev MACHINE +environment variable. +.It Oo Fl s Oc Ar section +Only select manuals from the specified +.Ar section . +The currently available sections are: +.Pp +.Bl -tag -width "localXXX" -offset indent -compact +.It 1 +General commands +.Pq tools and utilities . +.It 2 +System calls and error numbers. +.It 3 +Library functions. +.It 3p +.Xr perl 1 +programmer's reference guide. +.It 4 +Device drivers. +.It 5 +File formats. +.It 6 +Games. +.It 7 +Miscellaneous information. +.It 8 +System maintenance and operation commands. +.It 9 +Kernel internals. +.El +.It Fl T Ar output +Select the output format. +The default is +.Cm locale . +The other output modes +.Cm ascii , +.Cm html , +.Cm lint , +.Cm man , +.Cm pdf , +.Cm ps , +.Cm tree , +and +.Cm utf8 +are described in the +.Xr mandoc 1 +manual. +.It Fl W Ar level +Specify the minimum message +.Ar level +to be reported on the standard error output and to affect the exit status. +The +.Ar level +can be +.Cm warning , +.Cm error , +or +.Cm unsupp ; +.Cm all +is an alias for +.Cm warning . +By default, +.Nm +is silent. +See the +.Xr mandoc 1 +manual for details. +.It Fl w +List the pathnames of the manual pages which +.Nm +would display for the specified +.Ar section +and +.Ar name +combination. +.El +.Pp +Guidelines for writing +man pages can be found in +.Xr mdoc 7 . +.Pp +If both a formatted and an unformatted version of the same manual page, +for example +.Pa cat1/foo.0 +and +.Pa man1/foo.1 , +exist in the same directory, and at least one of them is selected, +only the newer one is used. +However, if both the +.Fl a +and the +.Fl w +options are specified, both file names are printed. +.Sh ENVIRONMENT +.Bl -tag -width MANPATHX +.It Ev MACHINE +As some manual pages are intended only for specific architectures, +.Nm +searches any subdirectories, +with the same name as the current architecture, +in every directory which it searches. +Machine specific areas are checked before general areas. +The current machine type may be overridden by setting the environment +variable +.Ev MACHINE +to the name of a specific architecture, +or with the +.Fl S +option. +.Ev MACHINE +is case insensitive. +.It Ev MANPAGER +Any non-empty value of the environment variable +.Ev MANPAGER +will be used instead of the standard pagination program, +.Xr more 1 . +If +.Xr less 1 +is used, the interactive +.Ic :t +command can be used to go to the definitions of various terms, for +example command line options, command modifiers, internal commands, +and environment variables. +.It Ev MANPATH +The standard search path used by +.Nm +may be overridden by specifying a path in the +.Ev MANPATH +environment +variable. +The format of the path is a colon +.Pq Ql \&: +separated list of directories. +.It Ev PAGER +Specifies the pagination program to use when +.Ev MANPAGER +is not defined. +If neither PAGER nor MANPAGER is defined, +.Xr more 1 +.Fl s +will be used. +.El +.Sh FILES +.Bl -tag -width /etc/man.conf -compact +.It Pa /etc/man.conf +default man configuration file +.El +.Sh EXIT STATUS +.Ex -std man +.Sh SEE ALSO +.Xr apropos 1 , +.Xr intro 1 , +.Xr whatis 1 , +.Xr whereis 1 , +.Xr intro 2 , +.Xr intro 3 , +.Xr intro 4 , +.Xr intro 5 , +.Xr man.conf 5 , +.Xr intro 6 , +.Xr intro 7 , +.Xr mdoc 7 , +.Xr intro 8 , +.Xr intro 9 +.Sh STANDARDS +The +.Nm +utility is compliant with the +.St -p1003.1-2008 +specification. +.Pp +The flags +.Op Fl aCcfhIKlMmOSsTWw , +as well as the environment variables +.Ev MACHINE , +.Ev MANPAGER , +and +.Ev MANPATH , +are extensions to that specification. +.Sh HISTORY +A +.Nm +command first appeared in +.At v3 . +.Pp +The +.Fl w +option first appeared in +.At v7 ; +.Fl f +and +.Fl k +in +.Bx 4 ; +.Fl M +in +.Bx 4.3 ; +.Fl a +in +.Bx 4.3 Tahoe ; +.Fl c +and +.Fl m +in +.Bx 4.3 Reno ; +.Fl h +in +.Bx 4.3 Net/2 ; +.Fl C +in +.Nx 1.0 ; +and +.Fl s +and +.Fl S +in +.Ox 2.3 . diff --git a/bin/mandoc/man.7 b/bin/mandoc/man.7 new file mode 100644 index 0000000000..bfeec51650 --- /dev/null +++ b/bin/mandoc/man.7 @@ -0,0 +1,928 @@ +.\" $Id: man.7,v 1.132 2015/01/29 00:33:57 schwarze Exp $ +.\" +.\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons +.\" Copyright (c) 2011-2015 Ingo Schwarze +.\" Copyright (c) 2010 Joerg Sonnenberger +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: January 29 2015 $ +.Dt MAN 7 +.Os +.Sh NAME +.Nm man +.Nd legacy formatting language for manual pages +.Sh DESCRIPTION +Traditionally, the +.Nm man +language has been used to write +.Ux +manuals for the +.Xr man 1 +utility. +It supports limited control of presentational details like fonts, +indentation and spacing. +This reference document describes the structure of manual pages +and the syntax and usage of the man language. +.Pp +.Bf -emphasis +Do not use +.Nm +to write your manuals: +.Ef +It lacks support for semantic markup. +Use the +.Xr mdoc 7 +language, instead. +.Pp +In a +.Nm +document, lines beginning with the control character +.Sq \&. +are called +.Dq macro lines . +The first word is the macro name. +It usually consists of two capital letters. +For a list of available macros, see +.Sx MACRO OVERVIEW . +The words following the macro name are arguments to the macro. +.Pp +Lines not beginning with the control character are called +.Dq text lines . +They provide free-form text to be printed; the formatting of the text +depends on the respective processing context: +.Bd -literal -offset indent +\&.SH Macro lines change control state. +Text lines are interpreted within the current state. +.Ed +.Pp +Many aspects of the basic syntax of the +.Nm +language are based on the +.Xr roff 7 +language; see the +.Em LANGUAGE SYNTAX +and +.Em MACRO SYNTAX +sections in the +.Xr roff 7 +manual for details, in particular regarding +comments, escape sequences, whitespace, and quoting. +.Sh MANUAL STRUCTURE +Each +.Nm +document must contain the +.Sx \&TH +macro describing the document's section and title. +It may occur anywhere in the document, although conventionally it +appears as the first macro. +.Pp +Beyond +.Sx \&TH , +at least one macro or text line must appear in the document. +.Pp +The following is a well-formed skeleton +.Nm +file for a utility +.Qq progname : +.Bd -literal -offset indent +\&.TH PROGNAME 1 2009-10-10 +\&.SH NAME +\efBprogname\efR \e(en one line about what it does +\&.\e\(dq .SH LIBRARY +\&.\e\(dq For sections 2, 3, and 9 only. +\&.\e\(dq Not used in OpenBSD. +\&.SH SYNOPSIS +\efBprogname\efR [\efB\e-options\efR] \efIfile ...\efR +\&.SH DESCRIPTION +The \efBfoo\efR utility processes files ... +\&.\e\(dq .Sh CONTEXT +\&.\e\(dq For section 9 functions only. +\&.\e\(dq .SH IMPLEMENTATION NOTES +\&.\e\(dq Not used in OpenBSD. +\&.\e\(dq .SH RETURN VALUES +\&.\e\(dq For sections 2, 3, and 9 function return values only. +\&.\e\(dq .SH ENVIRONMENT +\&.\e\(dq For sections 1, 6, 7, and 8 only. +\&.\e\(dq .SH FILES +\&.\e\(dq .SH EXIT STATUS +\&.\e\(dq For sections 1, 6, and 8 only. +\&.\e\(dq .SH EXAMPLES +\&.\e\(dq .SH DIAGNOSTICS +\&.\e\(dq For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. +\&.\e\(dq .SH ERRORS +\&.\e\(dq For sections 2, 3, 4, and 9 errno settings only. +\&.\e\(dq .SH SEE ALSO +\&.\e\(dq .BR foobar ( 1 ) +\&.\e\(dq .SH STANDARDS +\&.\e\(dq .SH HISTORY +\&.\e\(dq .SH AUTHORS +\&.\e\(dq .SH CAVEATS +\&.\e\(dq .SH BUGS +\&.\e\(dq .SH SECURITY CONSIDERATIONS +\&.\e\(dq Not used in OpenBSD. +.Ed +.Pp +The sections in a +.Nm +document are conventionally ordered as they appear above. +Sections should be composed as follows: +.Bl -ohang -offset indent +.It Em NAME +The name(s) and a short description of the documented material. +The syntax for this is generally as follows: +.Pp +.D1 \efBname\efR \e(en description +.It Em LIBRARY +The name of the library containing the documented material, which is +assumed to be a function in a section 2 or 3 manual. +For functions in the C library, this may be as follows: +.Pp +.D1 Standard C Library (libc, -lc) +.It Em SYNOPSIS +Documents the utility invocation syntax, function call syntax, or device +configuration. +.Pp +For the first, utilities (sections 1, 6, and 8), this is +generally structured as follows: +.Pp +.D1 \efBname\efR [-\efBab\efR] [-\efBc\efR\efIarg\efR] \efBpath\efR... +.Pp +For the second, function calls (sections 2, 3, 9): +.Pp +.D1 \&.B char *name(char *\efIarg\efR); +.Pp +And for the third, configurations (section 4): +.Pp +.D1 \&.B name* at cardbus ? function ? +.Pp +Manuals not in these sections generally don't need a +.Em SYNOPSIS . +.It Em DESCRIPTION +This expands upon the brief, one-line description in +.Em NAME . +It usually contains a break-down of the options (if documenting a +command). +.It Em CONTEXT +This section lists the contexts in which functions can be called in section 9. +The contexts are autoconf, process, or interrupt. +.It Em IMPLEMENTATION NOTES +Implementation-specific notes should be kept here. +This is useful when implementing standard functions that may have side +effects or notable algorithmic implications. +.It Em RETURN VALUES +This section documents the return values of functions in sections 2, 3, and 9. +.It Em ENVIRONMENT +Documents any usages of environment variables, e.g., +.Xr environ 7 . +.It Em FILES +Documents files used. +It's helpful to document both the file name and a short description of how +the file is used (created, modified, etc.). +.It Em EXIT STATUS +This section documents the command exit status for +section 1, 6, and 8 utilities. +Historically, this information was described in +.Em DIAGNOSTICS , +a practise that is now discouraged. +.It Em EXAMPLES +Example usages. +This often contains snippets of well-formed, +well-tested invocations. +Make sure that examples work properly! +.It Em DIAGNOSTICS +Documents error conditions. +In section 4 and 9 manuals, these are usually messages +printed by the kernel to the console and to the kernel log. +In section 1, 6, 7, and 8, these are usually messages +printed by userland programs to the standard error output. +.Pp +Historically, this section was used in place of +.Em EXIT STATUS +for manuals in sections 1, 6, and 8; however, this practise is +discouraged. +.It Em ERRORS +Documents +.Xr errno 2 +settings in sections 2, 3, 4, and 9. +.It Em SEE ALSO +References other manuals with related topics. +This section should exist for most manuals. +.Pp +.D1 \&.BR bar \&( 1 \&), +.Pp +Cross-references should conventionally be ordered +first by section, then alphabetically. +.It Em STANDARDS +References any standards implemented or used, such as +.Pp +.D1 IEEE Std 1003.2 (\e(lqPOSIX.2\e(rq) +.Pp +If not adhering to any standards, the +.Em HISTORY +section should be used. +.It Em HISTORY +A brief history of the subject, including where support first appeared. +.It Em AUTHORS +Credits to the person or persons who wrote the code and/or documentation. +Authors should generally be noted by both name and email address. +.It Em CAVEATS +Common misuses and misunderstandings should be explained +in this section. +.It Em BUGS +Known bugs, limitations, and work-arounds should be described +in this section. +.It Em SECURITY CONSIDERATIONS +Documents any security precautions that operators should consider. +.El +.Sh MACRO OVERVIEW +This overview is sorted such that macros of similar purpose are listed +together, to help find the best macro for any given purpose. +Deprecated macros are not included in the overview, but can be found +in the alphabetical reference below. +.Ss Page header and footer meta-data +.Bl -column "PP, LP, P" description +.It Sx TH Ta set the title: Ar title section date Op Ar source Op Ar volume +.It Sx AT Ta display AT&T UNIX version in the page footer (<= 1 argument) +.It Sx UC Ta display BSD version in the page footer (<= 1 argument) +.El +.Ss Sections and paragraphs +.Bl -column "PP, LP, P" description +.It Sx SH Ta section header (one line) +.It Sx SS Ta subsection header (one line) +.It Sx PP , LP , P Ta start an undecorated paragraph (no arguments) +.It Sx RS , RE Ta reset the left margin: Op Ar width +.It Sx IP Ta indented paragraph: Op Ar head Op Ar width +.It Sx TP Ta tagged paragraph: Op Ar width +.It Sx HP Ta hanged paragraph: Op Ar width +.It Sx PD Ta set vertical paragraph distance: Op Ar height +.It Sx \&br Ta force output line break in text mode (no arguments) +.It Sx \&sp Ta force vertical space: Op Ar height +.It Sx fi , nf Ta fill mode and no-fill mode (no arguments) +.It Sx in Ta additional indent: Op Ar width +.El +.Ss Physical markup +.Bl -column "PP, LP, P" description +.It Sx B Ta boldface font +.It Sx I Ta italic font +.It Sx R Ta roman (default) font +.It Sx SB Ta small boldface font +.It Sx SM Ta small roman font +.It Sx BI Ta alternate between boldface and italic fonts +.It Sx BR Ta alternate between boldface and roman fonts +.It Sx IB Ta alternate between italic and boldface fonts +.It Sx IR Ta alternate between italic and roman fonts +.It Sx RB Ta alternate between roman and boldface fonts +.It Sx RI Ta alternate between roman and italic fonts +.El +.Sh MACRO REFERENCE +This section is a canonical reference to all macros, arranged +alphabetically. +For the scoping of individual macros, see +.Sx MACRO SYNTAX . +.Ss \&AT +Sets the volume for the footer for compatibility with man pages from +.At +releases. +The optional arguments specify which release it is from. +.Ss \&B +Text is rendered in bold face. +.Pp +See also +.Sx \&I +and +.Sx \&R . +.Ss \&BI +Text is rendered alternately in bold face and italic. +Thus, +.Sq .BI this word and that +causes +.Sq this +and +.Sq and +to render in bold face, while +.Sq word +and +.Sq that +render in italics. +Whitespace between arguments is omitted in output. +.Pp +Examples: +.Pp +.Dl \&.BI bold italic bold italic +.Pp +The output of this example will be emboldened +.Dq bold +and italicised +.Dq italic , +with spaces stripped between arguments. +.Pp +See also +.Sx \&IB , +.Sx \&BR , +.Sx \&RB , +.Sx \&RI , +and +.Sx \&IR . +.Ss \&BR +Text is rendered alternately in bold face and roman (the default font). +Whitespace between arguments is omitted in output. +.Pp +See +.Sx \&BI +for an equivalent example. +.Pp +See also +.Sx \&BI , +.Sx \&IB , +.Sx \&RB , +.Sx \&RI , +and +.Sx \&IR . +.Ss \&DT +Has no effect. +Included for compatibility. +.Ss \&EE +This is a non-standard GNU extension, included only for compatibility. +In +.Xr mandoc 1 , +it does the same as +.Sx \&fi . +.Ss \&EX +This is a non-standard GNU extension, included only for compatibility. +In +.Xr mandoc 1 , +it does the same as +.Sx \&nf . +.Ss \&HP +Begin a paragraph whose initial output line is left-justified, but +subsequent output lines are indented, with the following syntax: +.Bd -filled -offset indent +.Pf \. Sx \&HP +.Op Ar width +.Ed +.Pp +The +.Ar width +argument is a +.Xr roff 7 +scaling width. +If specified, it's saved for later paragraph left-margins; if unspecified, the +saved or default width is used. +.Pp +See also +.Sx \&IP , +.Sx \&LP , +.Sx \&P , +.Sx \&PP , +and +.Sx \&TP . +.Ss \&I +Text is rendered in italics. +.Pp +See also +.Sx \&B +and +.Sx \&R . +.Ss \&IB +Text is rendered alternately in italics and bold face. +Whitespace between arguments is omitted in output. +.Pp +See +.Sx \&BI +for an equivalent example. +.Pp +See also +.Sx \&BI , +.Sx \&BR , +.Sx \&RB , +.Sx \&RI , +and +.Sx \&IR . +.Ss \&IP +Begin an indented paragraph with the following syntax: +.Bd -filled -offset indent +.Pf \. Sx \&IP +.Op Ar head Op Ar width +.Ed +.Pp +The +.Ar width +argument is a +.Xr roff 7 +scaling width defining the left margin. +It's saved for later paragraph left-margins; if unspecified, the saved or +default width is used. +.Pp +The +.Ar head +argument is used as a leading term, flushed to the left margin. +This is useful for bulleted paragraphs and so on. +.Pp +See also +.Sx \&HP , +.Sx \&LP , +.Sx \&P , +.Sx \&PP , +and +.Sx \&TP . +.Ss \&IR +Text is rendered alternately in italics and roman (the default font). +Whitespace between arguments is omitted in output. +.Pp +See +.Sx \&BI +for an equivalent example. +.Pp +See also +.Sx \&BI , +.Sx \&IB , +.Sx \&BR , +.Sx \&RB , +and +.Sx \&RI . +.Ss \&LP +Begin an undecorated paragraph. +The scope of a paragraph is closed by a subsequent paragraph, +sub-section, section, or end of file. +The saved paragraph left-margin width is reset to the default. +.Pp +See also +.Sx \&HP , +.Sx \&IP , +.Sx \&P , +.Sx \&PP , +and +.Sx \&TP . +.Ss \&OP +Optional command-line argument. +This is a non-standard GNU extension, included only for compatibility. +It has the following syntax: +.Bd -filled -offset indent +.Pf \. Sx \&OP +.Ar key Op Ar value +.Ed +.Pp +The +.Ar key +is usually a command-line flag and +.Ar value +its argument. +.Ss \&P +Synonym for +.Sx \&LP . +.Pp +See also +.Sx \&HP , +.Sx \&IP , +.Sx \&LP , +.Sx \&PP , +and +.Sx \&TP . +.Ss \&PD +Specify the vertical space to be inserted before each new paragraph. +.br +The syntax is as follows: +.Bd -filled -offset indent +.Pf \. Sx \&PD +.Op Ar height +.Ed +.Pp +The +.Ar height +argument is a +.Xr roff 7 +scaling width. +It defaults to +.Cm 1v . +If the unit is omitted, +.Cm v +is assumed. +.Pp +This macro affects the spacing before any subsequent instances of +.Sx \&HP , +.Sx \&IP , +.Sx \&LP , +.Sx \&P , +.Sx \&PP , +.Sx \&SH , +.Sx \&SS , +and +.Sx \&TP . +.Ss \&PP +Synonym for +.Sx \&LP . +.Pp +See also +.Sx \&HP , +.Sx \&IP , +.Sx \&LP , +.Sx \&P , +and +.Sx \&TP . +.Ss \&R +Text is rendered in roman (the default font). +.Pp +See also +.Sx \&I +and +.Sx \&B . +.Ss \&RB +Text is rendered alternately in roman (the default font) and bold face. +Whitespace between arguments is omitted in output. +.Pp +See +.Sx \&BI +for an equivalent example. +.Pp +See also +.Sx \&BI , +.Sx \&IB , +.Sx \&BR , +.Sx \&RI , +and +.Sx \&IR . +.Ss \&RE +Explicitly close out the scope of a prior +.Sx \&RS . +The default left margin is restored to the state before that +.Sx \&RS +invocation. +.Pp +The syntax is as follows: +.Bd -filled -offset indent +.Pf \. Sx \&RE +.Op Ar level +.Ed +.Pp +Without an argument, the most recent +.Sx \&RS +block is closed out. +If +.Ar level +is 1, all open +.Sx \&RS +blocks are closed out. +Otherwise, +.Ar level No \(mi 1 +nested +.Sx \&RS +blocks remain open. +.Ss \&RI +Text is rendered alternately in roman (the default font) and italics. +Whitespace between arguments is omitted in output. +.Pp +See +.Sx \&BI +for an equivalent example. +.Pp +See also +.Sx \&BI , +.Sx \&IB , +.Sx \&BR , +.Sx \&RB , +and +.Sx \&IR . +.Ss \&RS +Temporarily reset the default left margin. +This has the following syntax: +.Bd -filled -offset indent +.Pf \. Sx \&RS +.Op Ar width +.Ed +.Pp +The +.Ar width +argument is a +.Xr roff 7 +scaling width. +If not specified, the saved or default width is used. +.Pp +See also +.Sx \&RE . +.Ss \&SB +Text is rendered in small size (one point smaller than the default font) +bold face. +.Ss \&SH +Begin a section. +The scope of a section is only closed by another section or the end of +file. +The paragraph left-margin width is reset to the default. +.Ss \&SM +Text is rendered in small size (one point smaller than the default +font). +.Ss \&SS +Begin a sub-section. +The scope of a sub-section is closed by a subsequent sub-section, +section, or end of file. +The paragraph left-margin width is reset to the default. +.Ss \&TH +Sets the title of the manual page for use in the page header +and footer with the following syntax: +.Bd -filled -offset indent +.Pf \. Sx \&TH +.Ar title section date +.Op Ar source Op Ar volume +.Ed +.Pp +Conventionally, the document +.Ar title +is given in all caps. +The recommended +.Ar date +format is +.Sy YYYY-MM-DD +as specified in the ISO-8601 standard; +if the argument does not conform, it is printed verbatim. +If the +.Ar date +is empty or not specified, the current date is used. +The optional +.Ar source +string specifies the organisation providing the utility. +When unspecified, +.Xr mandoc 1 +uses its +.Fl Ios +argument. +The +.Ar volume +string replaces the default rendered volume, which is dictated by the +manual section. +.Pp +Examples: +.Pp +.Dl \&.TH CVS 5 "1992-02-12" GNU +.Ss \&TP +Begin a paragraph where the head, if exceeding the indentation width, is +followed by a newline; if not, the body follows on the same line after a +buffer to the indentation width. +Subsequent output lines are indented. +The syntax is as follows: +.Bd -filled -offset indent +.Pf \. Sx \&TP +.Op Ar width +.Ed +.Pp +The +.Ar width +argument is a +.Xr roff 7 +scaling width. +If specified, it's saved for later paragraph left-margins; if +unspecified, the saved or default width is used. +.Pp +See also +.Sx \&HP , +.Sx \&IP , +.Sx \&LP , +.Sx \&P , +and +.Sx \&PP . +.Ss \&UC +Sets the volume for the footer for compatibility with man pages from +.Bx +releases. +The optional first argument specifies which release it is from. +.Ss \&UE +End a uniform resource identifier block. +This is a non-standard GNU extension, included only for compatibility. +See +.Sx \&UE . +.Ss \&UR +Begin a uniform resource identifier block. +This is a non-standard GNU extension, included only for compatibility. +It has the following syntax: +.Bd -literal -offset indent +.Pf \. Sx \&UR Ar uri +link description to be shown +.Pf \. Sx UE +.Ed +.Ss \&br +Breaks the current line. +Consecutive invocations have no further effect. +.Pp +See also +.Sx \&sp . +.Ss \&fi +End literal mode begun by +.Sx \&nf . +.Ss \&in +Indent relative to the current indentation: +.Pp +.D1 Pf \. Sx \&in Op Ar width +.Pp +If +.Ar width +is signed, the new offset is relative. +Otherwise, it is absolute. +This value is reset upon the next paragraph, section, or sub-section. +.Ss \&nf +Begin literal mode: all subsequent free-form lines have their end of +line boundaries preserved. +May be ended by +.Sx \&fi . +Literal mode is implicitly ended by +.Sx \&SH +or +.Sx \&SS . +.Ss \&sp +Insert vertical spaces into output with the following syntax: +.Bd -filled -offset indent +.Pf \. Sx \&sp +.Op Ar height +.Ed +.Pp +The +.Ar height +argument is a scaling width as described in +.Xr roff 7 . +If 0, this is equivalent to the +.Sx \&br +macro. +Defaults to 1, if unspecified. +.Pp +See also +.Sx \&br . +.Sh MACRO SYNTAX +The +.Nm +macros are classified by scope: line scope or block scope. +Line macros are only scoped to the current line (and, in some +situations, the subsequent line). +Block macros are scoped to the current line and subsequent lines until +closed by another block macro. +.Ss Line Macros +Line macros are generally scoped to the current line, with the body +consisting of zero or more arguments. +If a macro is scoped to the next line and the line arguments are empty, +the next line, which must be text, is used instead. +Thus: +.Bd -literal -offset indent +\&.I +foo +.Ed +.Pp +is equivalent to +.Sq \&.I foo . +If next-line macros are invoked consecutively, only the last is used. +If a next-line macro is followed by a non-next-line macro, an error is +raised, except for +.Sx \&br +and +.Sx \&sp . +.Pp +The syntax is as follows: +.Bd -literal -offset indent +\&.YO \(lBbody...\(rB +\(lBbody...\(rB +.Ed +.Bl -column "MacroX" "ArgumentsX" "ScopeXXXXX" "CompatX" -offset indent +.It Em Macro Ta Em Arguments Ta Em Scope Ta Em Notes +.It Sx \&AT Ta <=1 Ta current Ta \& +.It Sx \&B Ta n Ta next-line Ta \& +.It Sx \&BI Ta n Ta current Ta \& +.It Sx \&BR Ta n Ta current Ta \& +.It Sx \&DT Ta 0 Ta current Ta \& +.It Sx \&EE Ta 0 Ta current Ta compat +.It Sx \&EX Ta 0 Ta current Ta compat +.It Sx \&I Ta n Ta next-line Ta \& +.It Sx \&IB Ta n Ta current Ta \& +.It Sx \&IR Ta n Ta current Ta \& +.It Sx \&OP Ta 0, 1 Ta current Ta compat +.It Sx \&PD Ta 1 Ta current Ta \& +.It Sx \&R Ta n Ta next-line Ta \& +.It Sx \&RB Ta n Ta current Ta \& +.It Sx \&RI Ta n Ta current Ta \& +.It Sx \&SB Ta n Ta next-line Ta \& +.It Sx \&SM Ta n Ta next-line Ta \& +.It Sx \&TH Ta >1, <6 Ta current Ta \& +.It Sx \&UC Ta <=1 Ta current Ta \& +.It Sx \&br Ta 0 Ta current Ta compat +.It Sx \&fi Ta 0 Ta current Ta compat +.It Sx \&in Ta 1 Ta current Ta compat +.It Sx \&nf Ta 0 Ta current Ta compat +.It Sx \&sp Ta 1 Ta current Ta compat +.El +.Pp +Macros marked as +.Qq compat +are included for compatibility with the significant corpus of existing +manuals that mix dialects of roff. +These macros should not be used for portable +.Nm +manuals. +.Ss Block Macros +Block macros comprise a head and body. +As with in-line macros, the head is scoped to the current line and, in +one circumstance, the next line (the next-line stipulations as in +.Sx Line Macros +apply here as well). +.Pp +The syntax is as follows: +.Bd -literal -offset indent +\&.YO \(lBhead...\(rB +\(lBhead...\(rB +\(lBbody...\(rB +.Ed +.Pp +The closure of body scope may be to the section, where a macro is closed +by +.Sx \&SH ; +sub-section, closed by a section or +.Sx \&SS ; +part, closed by a section, sub-section, or +.Sx \&RE ; +or paragraph, closed by a section, sub-section, part, +.Sx \&HP , +.Sx \&IP , +.Sx \&LP , +.Sx \&P , +.Sx \&PP , +or +.Sx \&TP . +No closure refers to an explicit block closing macro. +.Pp +As a rule, block macros may not be nested; thus, calling a block macro +while another block macro scope is open, and the open scope is not +implicitly closed, is syntactically incorrect. +.Bl -column "MacroX" "ArgumentsX" "Head ScopeX" "sub-sectionX" "compatX" -offset indent +.It Em Macro Ta Em Arguments Ta Em Head Scope Ta Em Body Scope Ta Em Notes +.It Sx \&HP Ta <2 Ta current Ta paragraph Ta \& +.It Sx \&IP Ta <3 Ta current Ta paragraph Ta \& +.It Sx \&LP Ta 0 Ta current Ta paragraph Ta \& +.It Sx \&P Ta 0 Ta current Ta paragraph Ta \& +.It Sx \&PP Ta 0 Ta current Ta paragraph Ta \& +.It Sx \&RE Ta 0 Ta current Ta none Ta compat +.It Sx \&RS Ta 1 Ta current Ta part Ta compat +.It Sx \&SH Ta >0 Ta next-line Ta section Ta \& +.It Sx \&SS Ta >0 Ta next-line Ta sub-section Ta \& +.It Sx \&TP Ta n Ta next-line Ta paragraph Ta \& +.It Sx \&UE Ta 0 Ta current Ta none Ta compat +.It Sx \&UR Ta 1 Ta current Ta part Ta compat +.El +.Pp +Macros marked +.Qq compat +are as mentioned in +.Sx Line Macros . +.Pp +If a block macro is next-line scoped, it may only be followed by in-line +macros for decorating text. +.Ss Font handling +In +.Nm +documents, both +.Sx Physical markup +macros and +.Xr roff 7 +.Ql \ef +font escape sequences can be used to choose fonts. +In text lines, the effect of manual font selection by escape sequences +only lasts until the next macro invocation; in macro lines, it only lasts +until the end of the macro scope. +Note that macros like +.Sx \&BR +open and close a font scope for each argument. +.Sh SEE ALSO +.Xr man 1 , +.Xr mandoc 1 , +.Xr eqn 7 , +.Xr mandoc_char 7 , +.Xr mdoc 7 , +.Xr roff 7 , +.Xr tbl 7 +.Sh HISTORY +The +.Nm +language first appeared as a macro package for the roff typesetting +system in +.At v7 . +It was later rewritten by James Clark as a macro package for groff. +Eric S. Raymond wrote the extended +.Nm +macros for groff in 2007. +The stand-alone implementation that is part of the +.Xr mandoc 1 +utility written by Kristaps Dzonsons appeared in +.Ox 4.6 . +.Sh AUTHORS +This +.Nm +reference was written by +.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv . +.Sh CAVEATS +Do not use this language. +Use +.Xr mdoc 7 , +instead. diff --git a/bin/mandoc/man.conf.5 b/bin/mandoc/man.conf.5 new file mode 100644 index 0000000000..9cfeca761d --- /dev/null +++ b/bin/mandoc/man.conf.5 @@ -0,0 +1,131 @@ +.\" $Id: man.conf.5,v 1.3 2015/03/27 21:33:20 schwarze Exp $ +.\" +.\" Copyright (c) 2015 Ingo Schwarze +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate: March 27 2015 $ +.Dt MAN.CONF 5 +.Os +.Sh NAME +.Nm man.conf +.Nd configuration file for man +.Sh DESCRIPTION +This is the configuration file +for the +.Xr man 1 , +.Xr apropos 1 , +and +.Xr makewhatis 8 +utilities. +Its presence, and all directives, are optional. +.Pp +This file is an ASCII text file. +Leading whitespace on lines, lines starting with +.Sq # , +and blank lines are ignored. +Words are separated by whitespace. +The first word on each line is the name of a configuration directive. +.Pp +The following directives are supported: +.Bl -tag -width Ds +.It Ic manpath Ar path +Override the default search +.Ar path +for +.Xr man 1 , +.Xr apropos 1 , +and +.Xr makewhatis 8 . +It can be used multiple times to specify multiple paths, +with the order determining the manual page search order. +.Pp +Each path is a tree containing subdirectories +whose names consist of the strings +.Sq man +and/or +.Sq cat +followed by the names of sections, usually single digits. +The former are supposed to contain unformatted manual pages in +.Xr mdoc 7 +and/or +.Xr man 7 +format; file names should end with the name of the section +preceded by a dot. +The latter should contain preformatted manual pages; +file names should end with +.Ql .0 . +.Pp +Creating a +.Xr mandoc.db 5 +database with +.Xr makewhatis 8 +in each directory configured with +.Ic manpath +is recommended and necessary for +.Xr apropos 1 +to work, but not strictly required for +.Xr man 1 . +.It Ic output Ar option Op Ar value +Configure the default value of an output option. +These directives are overridden by the +.Fl O +command line options of the same names. +For details, see the +.Xr mandoc 1 +manual. +.Pp +.Bl -column fragment integer "ascii, utf8" -compact +.It Ar option Ta Ar value Ta used by Fl T Ta purpose +.It Ta Ta Ta +.It Ic fragment Ta none Ta Cm html Ta print only body +.It Ic includes Ta string Ta Cm html Ta path to header files +.It Ic indent Ta integer Ta Cm ascii , utf8 Ta left margin +.It Ic man Ta string Ta Cm html Ta path for Xr links +.It Ic paper Ta string Ta Cm ps , pdf Ta paper size +.It Ic style Ta string Ta Cm html Ta CSS file +.It Ic width Ta integer Ta Cm ascii , utf8 Ta right margin +.El +.It Ic _whatdb Ar path Ns Cm /whatis.db +This directive provides the same functionality as +.Ic manpath , +but using a historic and misleading syntax. +It is kept for backward compatibility for now, +but will eventually be removed. +.El +.Sh FILES +.Pa /etc/man.conf +.Sh EXAMPLES +The following configuration file reproduces the defaults: +installing it is equivalent to not having a +.Nm +file at all. +.Bd -literal -offset indent +manpath /usr/share/man +manpath /usr/X11R6/man +manpath /usr/local/man +.Ed +.Sh SEE ALSO +.Xr apropos 1 , +.Xr man 1 , +.Xr makewhatis 8 +.Sh HISTORY +A relatively complicated +.Nm +file format first appeared in +.Bx 4.3 Reno . +For +.Ox 5.8 , +it was redesigned from scratch, aiming for simplicity. +.Sh AUTHORS +.An Ingo Schwarze Aq Mt schwarze@openbsd.org diff --git a/bin/mandoc/mandoc.1 b/bin/mandoc/mandoc.1 index d66d47a491..f4707aa28b 100644 --- a/bin/mandoc/mandoc.1 +++ b/bin/mandoc/mandoc.1 @@ -41,9 +41,9 @@ manual pages for display. By default, .Nm reads -.Xr mdoc 5 +.Xr mdoc 7 or -.Xr man 5 +.Xr man 7 text from stdin, implying .Fl m Ns Cm andoc , and produces @@ -79,10 +79,10 @@ options. Override the default operating system .Ar name for the -.Xr mdoc 5 +.Xr mdoc 7 .Sq \&Os and for the -.Xr man 5 +.Xr man 7 .Sq \&TH macro. .It Fl h @@ -114,9 +114,22 @@ if the first non-ASCII byte in the file introduces a valid UTF-8 sequence .It Cm iso-8859-1 otherwise .El +.It Fl k +A synonym for +.Xr apropos 1 . +This overrides any earlier +.Fl f +and +.Fl l +options. .It Fl l A synonym for .Fl a . +Also reverts any earlier +.Fl f +and +.Fl k +options. .It Fl m Ns Ar format Input format. See @@ -176,24 +189,36 @@ If multiple files are specified, .Nm will halt with the first failed parse. .El +.Pp +In +.Fl f +and +.Fl k +mode, +.Nm +also supports the options +.Fl CMmOSsw +described in the +.Xr apropos 1 +manual. .Ss Input Formats The .Nm utility accepts -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 input with .Fl m Ns Cm doc and .Fl m Ns Cm an , respectively. The -.Xr mdoc 5 +.Xr mdoc 7 format is .Em strongly recommended; -.Xr man 5 +.Xr man 7 should only be used for legacy manuals. .Pp A third option, @@ -204,9 +229,9 @@ non-comment macro is or .Sq \&Dt , the -.Xr mdoc 5 +.Xr mdoc 7 parser is used; otherwise, the -.Xr man 5 +.Xr man 7 parser is used. .Pp If multiple @@ -234,7 +259,7 @@ See Produce HTML5, CSS1, and MathML output. See .Sx HTML Output . -.It Fl T Ns Cm lint +.It Fl T Cm lint Parse only: produce no output. Implies .Fl W Cm warning . @@ -245,7 +270,7 @@ See .Sx Locale Output . .It Fl T Cm man Produce -.Xr man 5 +.Xr man 7 format output. See .Sx Man Output . @@ -259,6 +284,8 @@ See .Sx PostScript Output . .It Fl T Cm tree Produce an indented parse tree. +See +.Sx Syntax tree output . .It Fl T Cm utf8 Encode output in the UTF\-8 multi-byte format. See @@ -274,7 +301,7 @@ corresponding filter in-order. Output produced by .Fl T Cm ascii is rendered in standard 7-bit ASCII documented in -.Xr ascii 5 . +.Xr ascii 7 . .Pp Font styles are applied by using back-spaced encoding such that an underlined character @@ -288,7 +315,7 @@ Emboldened characters are rendered as .Sq c Ns \e[bs] Ns c . .Pp The special characters documented in -.Xr mandoc_char 5 +.Xr mandoc_char 7 are rendered best-effort in an ASCII equivalent. .Pp Output width is limited to 78 visible columns unless literal input lines @@ -302,9 +329,9 @@ arguments are accepted: The left margin for normal text is set to .Ar indent blank characters instead of the default of five for -.Xr mdoc 5 +.Xr mdoc 7 and seven for -.Xr man 5 . +.Xr man 7 . Increasing this is not recommended; it may result in degraded formatting, for example overfull lines or ugly line breaks. .It Cm width Ns = Ns Ar width @@ -318,7 +345,7 @@ Output produced by conforms to HTML5 using optional self-closing tags. Default styles use only CSS1. Equations rendered from -.Xr eqn 5 +.Xr eqn 7 blocks use MathML. .Pp The @@ -384,23 +411,31 @@ relative URI. Locale-depending output encoding is triggered with .Fl T Cm locale . This is the default. +.Pp +This option is not available on all systems: systems without locale +support, or those whose internal representation is not natively UCS-4, +will fall back to +.Fl T Cm ascii . +See +.Sx ASCII Output +for font style specification and available command-line arguments. .Ss Man Output Translate input format into -.Xr man 5 +.Xr man 7 output format. This is useful for distributing manual sources to legacy systems lacking -.Xr mdoc 5 +.Xr mdoc 7 formatters. .Pp If -.Xr mdoc 5 +.Xr mdoc 7 is passed as input, it is translated into -.Xr man 5 . +.Xr man 7 . If the input format is -.Xr man 5 , +.Xr man 7 , the input is copied to the output, expanding any -.Xr mandoc_roff 5 +.Xr roff 7 .Sq so requests. The parser is also run, and as usual, the @@ -470,10 +505,10 @@ The columns are: .Bl -enum -compact .It For macro nodes, the macro name; for text and -.Xr tbl 5 +.Xr tbl 7 nodes, the content. There is a special format for -.Xr eqn 5 +.Xr eqn 7 nodes. .It Node type (text, elem, block, head, body, body-end, tail, tbl, eqn). @@ -496,6 +531,22 @@ A closing parenthesis if the node is a closing delimiter. A full stop if the node ends a sentence. .El .El +.Sh ENVIRONMENT +.Bl -tag -width MANPAGER +.It Ev MANPAGER +Any non-empty value of the environment variable +.Ev MANPAGER +will be used instead of the standard pagination program, +.Xr more 1 . +.It Ev PAGER +Specifies the pagination program to use when +.Ev MANPAGER +is not defined. +If neither PAGER nor MANPAGER is defined, +.Xr more 1 +.Fl s +will be used. +.El .Sh EXIT STATUS The .Nm @@ -547,13 +598,13 @@ output mode implies To page manuals to the terminal: .Pp .Dl $ mandoc \-W all,stop mandoc.1 2\*(Gt&1 | less -.Dl $ mandoc mandoc.1 mdoc.3 mdoc.5 | less +.Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less .Pp To produce HTML manuals with .Pa mandoc.css as the style-sheet: .Pp -.Dl $ mandoc \-T html -Ostyle=mandoc.css mdoc.5 \*(Gt mdoc.5.html +.Dl $ mandoc \-T html -O style=mandoc.css mdoc.7 \*(Gt mdoc.7.html .Pp To check over a large set of manuals: .Pp @@ -561,14 +612,14 @@ To check over a large set of manuals: .Pp To produce a series of PostScript manuals for A4 paper: .Pp -.Dl $ mandoc \-T ps \-O paper=a4 mdoc.5 man.5 \*(Gt manuals.ps +.Dl $ mandoc \-T ps \-O paper=a4 mdoc.7 man.7 \*(Gt manuals.ps .Pp Convert a modern -.Xr mdoc 5 +.Xr mdoc 7 manual to the older -.Xr man 5 +.Xr man 7 format, for use on systems lacking an -.Xr mdoc 5 +.Xr mdoc 7 parser: .Pp .Dl $ mandoc \-T man foo.mdoc \*(Gt foo.man @@ -594,7 +645,7 @@ Message levels have the following meanings: .Bl -tag -width "warning" .It Cm unsupp An input file uses unsupported low-level -.Xr mandoc_roff 5 +.Xr roff 7 features. The output may be incomplete and/or misformatted, so using GNU troff instead of @@ -676,14 +727,14 @@ line is invalid, but still used. .It Sy "missing date, using today's date" .Pq mdoc, man The document was parsed as -.Xr mdoc 5 +.Xr mdoc 7 and it has no .Ic \&Dd macro, or the .Ic \&Dd macro has no arguments or only empty arguments; or the document was parsed as -.Xr man 5 +.Xr man 7 and it has no .Ic \&TH macro, or the @@ -825,7 +876,7 @@ Probably, there are author names lacking markup. .It Sy "obsolete macro" .Pq mdoc See the -.Xr mdoc 5 +.Xr mdoc 7 manual for replacements. .It Sy "macro neither callable nor escaped" .Pq mdoc @@ -836,7 +887,7 @@ otherwise, escape it by prepending .Sq \e& . .It Sy "skipping paragraph macro" In -.Xr mdoc 5 +.Xr mdoc 7 documents, this happens .Bl -dash -compact .It @@ -849,7 +900,7 @@ at the end of items in non-column, non-compact lists and for multiple consecutive paragraph macros. .El In -.Xr man 5 +.Xr man 7 documents, it happens .Bl -dash -compact .It @@ -950,7 +1001,7 @@ The previous, interrupted macro is deleted from the parse tree. .Pq roff , eqn The macro name is missing from a macro definition request, or an -.Xr eqn 5 +.Xr eqn 7 control statement or operation keyword lacks its required argument. .It Sy "conditional request controls empty scope" .Pq roff @@ -1017,7 +1068,7 @@ macro, at least one other argument precedes the type argument. The .Nm utility copes with any argument order, but some other -.Xr mdoc 5 +.Xr mdoc 7 implementations do not. .It Sy "missing -width in -tag list, using 8n" .Pq mdoc @@ -1238,10 +1289,10 @@ empty, causing it to toggle the spacing mode. .It Sy "unknown font, skipping request" .Pq man , tbl A -.Xr mandoc_roff 5 +.Xr roff 7 .Ic \&ft request or a -.Xr tbl 5 +.Xr tbl 7 .Ic \&f layout modifier has an unknown .Ar font @@ -1411,7 +1462,7 @@ some content, but the parser can continue. .It Sy "skipping bad character" .Pq mdoc , man , roff The input file contains a byte that is not a printable -.Xr ascii 5 +.Xr ascii 7 character. The message mentions the character number. The offending byte is replaced with a question mark @@ -1421,11 +1472,11 @@ transliteration of the intended character. .It Sy "skipping unknown macro" .Pq mdoc , man , roff The first identifier on a request or macro line is neither recognized as a -.Xr mandoc_roff 5 +.Xr roff 7 request, nor as a user-defined macro, nor, respectively, as an -.Xr mdoc 5 +.Xr mdoc 7 or -.Xr man 5 +.Xr man 7 macro. It may be mistyped or unsupported. The request or macro is discarded including its arguments. @@ -1441,7 +1492,7 @@ An macro occurs outside any .Ic \&Bl list, or an -.Xr eqn 5 +.Xr eqn 7 .Ic above delimiter occurs outside any pile. It is discarded including its arguments. @@ -1458,16 +1509,16 @@ It is discarded including its arguments. Various syntax elements can only be used to explicitly close blocks that have previously been opened. An -.Xr mdoc 5 +.Xr mdoc 7 block closing macro, a -.Xr man 5 +.Xr man 7 .Ic \&RE or .Ic \&UE macro, an -.Xr eqn 5 +.Xr eqn 7 right delimiter or closing brace, or the end of an equation, table, or -.Xr mandoc_roff 5 +.Xr roff 7 conditional request is encountered but no matching block is open. The offending request or macro is discarded. .It Sy "fewer RS blocks open, skipping" @@ -1483,7 +1534,7 @@ macro is discarded. .It Sy "inserting missing end of block" .Pq mdoc , tbl Various -.Xr mdoc 5 +.Xr mdoc 7 macros as well as tables require explicit closing by dedicated macros. A block that doesn't support bad nesting ends before all of its children are properly closed. @@ -1491,15 +1542,15 @@ The open child nodes are closed implicitly. .It Sy "appending missing end of block" .Pq mdoc , man , eqn , tbl , roff At the end of the document, an explicit -.Xr mdoc 5 +.Xr mdoc 7 block, a -.Xr man 5 +.Xr man 7 next-line scope or .Ic \&RS or .Ic \&UR block, an equation, table, or -.Xr mandoc_roff 5 +.Xr roff 7 conditional or ignore block is still open. The open block is closed implicitly. .It Sy "escaped character not allowed in a name" @@ -1589,7 +1640,7 @@ macro has an unknown argument and is discarded. An .Ic \&it request or an -.Xr eqn 5 +.Xr eqn 7 .Ic \&size or .Ic \&gsize @@ -1621,7 +1672,7 @@ only shows the path as it appears behind .It Sy "skipping all arguments" .Pq mdoc , man , eqn , roff An -.Xr mdoc 5 +.Xr mdoc 7 .Ic \&Bt , .Ic \&Ed , .Ic \&Ef , @@ -1636,18 +1687,18 @@ or macro, an .Ic \&It macro in a list that don't support item heads, a -.Xr man 5 +.Xr man 7 .Ic \&LP , .Ic \&P , or .Ic \&PP macro, an -.Xr eqn 5 +.Xr eqn 7 .Ic \&EQ or .Ic \&EN macro, or a -.Xr mandoc_roff 5 +.Xr roff 7 .Ic \&br , .Ic \&fi , or @@ -1711,7 +1762,7 @@ Parsing is aborted as soon as the condition is detected. .It Sy "unsupported control character" .Pq roff An ASCII control character supported by other -.Xr mandoc_roff 5 +.Xr roff 7 implementations but not by .Nm was found in an input file. @@ -1719,7 +1770,7 @@ It is replaced by a question mark. .It Sy "unsupported roff request" .Pq roff An input file contains a -.Xr mandoc_roff 5 +.Xr roff 7 request supported by GNU troff or Heirloom troff but not by .Nm , and it is likely that this will cause information loss @@ -1737,20 +1788,22 @@ The modifier is discarded. .It Sy "ignoring macro in table" .Pq tbl , mdoc , man A table contains an invocation of an -.Xr mdoc 5 +.Xr mdoc 7 or -.Xr man 5 +.Xr man 7 macro or of an undefined macro. The macro is ignored, and its arguments are handled as if they were a text line. .El .Sh SEE ALSO -.Xr eqn 5 , -.Xr man 5 , -.Xr mandoc_char 5 , -.Xr mandoc_roff 5 , -.Xr mdoc 5 , -.Xr tbl 5 +.Xr apropos 1 , +.Xr man 1 , +.Xr eqn 7 , +.Xr man 7 , +.Xr mandoc_char 7 , +.Xr mdoc 7 , +.Xr roff 7 , +.Xr tbl 7 .Sh AUTHORS .An -nosplit The diff --git a/bin/mandoc/mandoc_char.5 b/bin/mandoc/mandoc_char.7 similarity index 99% rename from bin/mandoc/mandoc_char.5 rename to bin/mandoc/mandoc_char.7 index cf102bb840..d272080fc1 100644 --- a/bin/mandoc/mandoc_char.5 +++ b/bin/mandoc/mandoc_char.7 @@ -17,20 +17,20 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: September 2 2015 $ -.Dt MANDOC_CHAR 5 +.Dt MANDOC_CHAR 7 .Os .Sh NAME .Nm mandoc_char .Nd mandoc special characters .Sh DESCRIPTION This page documents the -.Xr mandoc_roff 5 +.Xr roff 7 escape sequences accepted by .Xr mandoc 1 to represent special characters in -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 documents. .Pp The rendering depends on the @@ -114,7 +114,7 @@ On request and macro lines, the normal space character serves as an argument delimiter. To include whitespace into arguments, quoting is usually the best choice; see the MACRO SYNTAX section in -.Xr mandoc_roff 5 . +.Xr roff 7 . In some cases, using the non-breaking space escape sequence .Pq Sq \e\ \& may be preferable. @@ -124,7 +124,7 @@ of input lines, the zero-width space .Pq Sq \e& is often useful. For example, in -.Xr mdoc 5 , +.Xr mdoc 7 , a normal space character can be displayed in single quotes in either of the following ways: .Pp @@ -146,7 +146,7 @@ even on request and macro lines. In output modes supporting such special output characters, for example .Fl T Cm pdf , some -.Xr mandoc_roff 5 +.Xr roff 7 formatters convert the following ASCII input characters to the following Unicode special output characters: .Bl -column x(ga U+2018 -offset indent @@ -169,9 +169,9 @@ The period .Pq Sq \&. is handled specially at the beginning of an input line, where it introduces a -.Xr mandoc_roff 5 +.Xr roff 7 request or a macro, and when appearing alone as a macro argument in -.Xr mdoc 5 . +.Xr mdoc 7 . In such situations, prepend a zero-width space .Pq Sq \e&. to make it behave like normal text. @@ -193,11 +193,11 @@ is not the right way to output a backslash. Because .Xr mandoc 1 does not implement full -.Xr mandoc_roff 5 +.Xr roff 7 functionality, it may work with .Xr mandoc 1 , but it may have weird effects on complete -.Xr mandoc_roff 5 +.Xr roff 7 implementations. .Sh SPECIAL CHARACTERS Special characters are encoded as @@ -211,7 +211,7 @@ and For details, see the .Em Special Characters subsection of the -.Xr mandoc_roff 5 +.Xr roff 7 manual. .Pp Spacing: @@ -643,7 +643,7 @@ and For details, see the .Em Predefined Strings subsection of the -.Xr mandoc_roff 5 +.Xr roff 7 manual. .Bl -column "Input" "Rendered" "Description" -offset indent .It Em Input Ta Em Rendered Ta Em Description @@ -744,9 +744,9 @@ known representation. .El .Sh SEE ALSO .Xr mandoc 1 , -.Xr man 5 , -.Xr mandoc_roff 5 , -.Xr mdoc 5 +.Xr man 7 , +.Xr mdoc 7 , +.Xr roff 7 .Sh AUTHORS The .Nm @@ -758,7 +758,7 @@ The predefined string mimics the behaviour of the .Sq \&| character in -.Xr mdoc 5 ; +.Xr mdoc 7 ; thus, if you wish to render a vertical bar with no side effects, use the .Sq \e(ba diff --git a/bin/mandoc/mdoc.5 b/bin/mandoc/mdoc.7 similarity index 90% rename from bin/mandoc/mdoc.5 rename to bin/mandoc/mdoc.7 index 643a269781..198a46a963 100644 --- a/bin/mandoc/mdoc.5 +++ b/bin/mandoc/mdoc.7 @@ -15,12 +15,8 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.\" -.\" Copyright 2014 Garrett D'Amore -.\" Copyright 2015 Nexenta Systems, Inc. All rights reserved. -.\" .Dd $Mdocdate: November 5 2015 $ -.Dt MDOC 5 +.Dt MDOC 7 .Os .Sh NAME .Nm mdoc @@ -75,17 +71,17 @@ Text lines are interpreted within the current state. Many aspects of the basic syntax of the .Nm language are based on the -.Xr mandoc_roff 5 +.Xr roff 7 language; see the .Em LANGUAGE SYNTAX and .Em MACRO SYNTAX sections in the -.Xr mandoc_roff 5 +.Xr roff 7 manual for details, in particular regarding comments, escape sequences, whitespace, and quoting. However, using -.Xr mandoc_roff 5 +.Xr roff 7 requests in .Nm documents is discouraged; @@ -122,7 +118,7 @@ The following is a well-formed skeleton file for a utility .Qq progname : .Bd -literal -offset indent -\&.Dd Jan 1, 1970 +\&.Dd $\&Mdocdate$ \&.Dt PROGNAME section \&.Os \&.Sh NAME @@ -130,6 +126,7 @@ file for a utility \&.Nd one line about what it does \&.\e\(dq .Sh LIBRARY \&.\e\(dq For sections 2, 3, and 9 only. +\&.\e\(dq Not used in OpenBSD. \&.Sh SYNOPSIS \&.Nm progname \&.Op Fl options @@ -138,27 +135,22 @@ file for a utility The \&.Nm utility processes files ... -\&.\e\(dq .Sh IMPLEMENTATION NOTES -\&.\e\(dq .Sh RETURN VALUES -\&.\e\(dq For sections 2, 3, and 9 only. \&.\e\(dq .Sh CONTEXT \&.\e\(dq For section 9 functions only. +\&.\e\(dq .Sh IMPLEMENTATION NOTES +\&.\e\(dq Not used in OpenBSD. +\&.\e\(dq .Sh RETURN VALUES +\&.\e\(dq For sections 2, 3, and 9 function return values only. \&.\e\(dq .Sh ENVIRONMENT -\&.\e\(dq For sections 1, 1M, and 5. +\&.\e\(dq For sections 1, 6, 7, and 8 only. \&.\e\(dq .Sh FILES \&.\e\(dq .Sh EXIT STATUS -\&.\e\(dq For sections 1, 1M, and 5. +\&.\e\(dq For sections 1, 6, and 8 only. \&.\e\(dq .Sh EXAMPLES \&.\e\(dq .Sh DIAGNOSTICS +\&.\e\(dq For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. \&.\e\(dq .Sh ERRORS -\&.\e\(dq For sections 2, 3, and 9 only. -\&.\e\(dq .Sh ARCHITECTURE -\&.\e\(dq .Sh CODE SET INDEPENDENCE -\&.\e\(dq For sections 1, 1M, and 3 only. -\&.\e\(dq .Sh INTERFACE STABILITY -\&.\e\(dq .Sh MT-LEVEL -\&.\e\(dq For sections 2 and 3 only. -\&.\e\(dq .Sh SECURITY +\&.\e\(dq For sections 2, 3, 4, and 9 errno settings only. \&.\e\(dq .Sh SEE ALSO \&.\e\(dq .Xr foobar 1 \&.\e\(dq .Sh STANDARDS @@ -166,6 +158,8 @@ utility processes files ... \&.\e\(dq .Sh AUTHORS \&.\e\(dq .Sh CAVEATS \&.\e\(dq .Sh BUGS +\&.\e\(dq .Sh SECURITY CONSIDERATIONS +\&.\e\(dq Not used in OpenBSD. .Ed .Pp The sections in an @@ -211,7 +205,7 @@ See Documents the utility invocation syntax, function call syntax, or device configuration. .Pp -For the first, utilities (sections 1 and 1M), this is +For the first, utilities (sections 1, 6, and 8), this is generally structured as follows: .Bd -literal -offset indent \&.Nm bar @@ -226,7 +220,7 @@ generally structured as follows: .Pp Commands should be ordered alphabetically. .Pp -For the second, function calls (sections 2, 3, 7I, 7P, 9): +For the second, function calls (sections 2, 3, 9): .Bd -literal -offset indent \&.In header.h \&.Vt extern const char *global; @@ -244,9 +238,10 @@ and .Sx \&Fo macros should follow C header-file conventions. .Pp -And for the third, configurations (section 7D): +And for the third, configurations (section 4): .Bd -literal -offset indent -\&.Pa /dev/device_node +\&.Cd \(dqit* at isa? port 0x2e\(dq +\&.Cd \(dqit* at isa? port 0x4e\(dq .Ed .Pp Manuals not in these sections generally don't need a @@ -330,6 +325,9 @@ macro followed by a non-standard section name, and each having several subsections, like in the present .Nm manual. +.It Em CONTEXT +This section lists the contexts in which functions can be called in section 9. +The contexts are autoconf, process, or interrupt. .It Em IMPLEMENTATION NOTES Implementation-specific notes should be kept here. This is useful when implementing standard functions that may have side @@ -340,14 +338,11 @@ return values of functions in sections 2, 3, and 9. .Pp See .Sx \&Rv . -.It Em CONTEXT -This section lists the contexts in which functions can be called in section 9. -The contexts are user, kernel, or interrupt. .It Em ENVIRONMENT Lists the environment variables used by the utility, and explains the syntax and semantics of their values. The -.Xr environ 5 +.Xr environ 7 manual provides examples of typical content and formatting. .Pp See @@ -361,7 +356,7 @@ See .Sx \&Pa . .It Em EXIT STATUS This section documents the -command exit status for sections 1 and 1M. +command exit status for section 1, 6, and 8 utilities. Historically, this information was described in .Em DIAGNOSTICS , a practise that is now discouraged. @@ -373,136 +368,27 @@ Example usages. This often contains snippets of well-formed, well-tested invocations. Make sure that examples work properly! .It Em DIAGNOSTICS -Documents error and diagnostic messages displayed to the user or -sent to logs. Note that exit -status and return values should be documented in the +Documents error messages. +In section 4 and 9 manuals, these are usually messages printed by the +kernel to the console and to the kernel log. +In section 1, 6, 7, and 8, these are usually messages printed by +userland programs to the standard error output. +.Pp +Historically, this section was used in place of .Em EXIT STATUS -and -.Em RETURN VALUES -sections. +for manuals in sections 1, 6, and 8; however, this practise is +discouraged. .Pp See .Sx \&Bl .Fl diag . .It Em ERRORS -Documents error handling in sections 2, 3, and 9. +Documents +.Xr errno 2 +settings in sections 2, 3, 4, and 9. .Pp See .Sx \&Er . -.It Em ARCHITECTURE -This section is usually absent, but will be present when the -interface is specific to one or more architectures. -.It Em CODE SET INDEPENDENCE -Indicates whether the interface operates correctly with various different -code sets. True independent code sets will support not only ASCII and -Extended UNIX Codesets (EUC), but also other multi-byte encodings such as -UTF-8 and GB2312. -.Pp -Generally there will be some limitations that are fairly standard. See -.Xr standards 5 for more information about some of these. Most interfaces -should support at least UTF-8 in addition to ASCII. -.It Em INTERFACE STABILITY -Indicates the level of commitment to the interface. Interfaces can be described -with in the following ways: -.Bl -tag -width Ds -.It Nm Standard -Indicates that the interface is defined by one or more standards bodies. -Generally, changes to the interface will be carefully managed to conform -to the relevant standards. These interfaces are generally the most suitable -for use in portable programs. -.It Nm Committed -Indicates that the interface is intended to be preserved for the long-haul, and -will rarely, if ever change, and never without notification (barring -extraordinary and extenuating circumstances). These interfaces are -preferred over other interfaces with the exeception of -.Nm Standard -interfaces. -.It Nm Uncommitted -Indicates that the interface may change. Generally, changes to these interfaces -should be infrequent, and some effort will be made to address compatibility -considerations when changing or removing such interfaces. However, there is -no firm commitment to the preservation of the interface. Most often this -is applied to interfaces where operational experience with the interface -is still limited and some need to change may be anticipated. -.Pp -Consumers should expect to revalidate any -.Nm Uncommitted -interfaces when crossing release boundaries. Products intended for -use on many releases or intended to support compatibility with future -releases should avoid these interfaces. -.It Nm Volatile -The interface can change at any time for any reason. Often this relates to -interfaces that are part of external software components that are still evolving -rapidly. Consumers should not expect that the interface (either binary or -source level) will be unchanged from one release to the next. -.It Nm Not-an-Interface -Describes something that is specifically not intended for programmatic -consumption. For example, specific human-readable output, or the layout -of graphical items on a user interface, may be described this way. Generally -programmatic alternatives to these will be available, and should be used -when programmatic consumption is needed. -.It Nm Private -This is an internal interface. Generally these interfaces should only be -used within the project, and should not be used by other programs or modules. -The interface can and will change without notice as the project needs, at -any time. -.Pp -Most often, Private interfaces will lack any documentation whatsoever, and -generally any undocumented interface can be assumed to be Private. -.It Nm Obsolete -The interface is not intended for use in new projects or programs, and may -be removed at a future date. The -.Nm Obsolete -word is a modifier that can -be applied to other commitment levels. For example an -.Nm Obsolete Committed -interface is unlikely to be removed or changed, but nonetheless new use -is discouraged (perhaps a better newer alternative is present). -.El -.It Em MT-LEVEL -This section describes considerations for the interface when used within -programs that use multiple threads. More discussion of these considerations -is made in the MT-Level section of -.Xr attributes 5 . -The interface can be described in the following ways. -.Bl -tag -width Ds -.It Nm Safe -Indicates the interface is safe for use within multiple threads. There -may be additional caveats that apply, in which case those will be -described. Note that some interfaces have semantics which may affect -other threads, but these should be an intrinsic part of the interface -rather than an unexpected side effect. For example, closing a file in -one thread will cause that file to be closed in all threads. -.It Nm Unsafe -Indicates the interface is unsuitable for concurrent use within multiple -threads. A threaded application may still make use of the interface, but -will be required to provide external synchronization means to ensure that -only a single thread calls the interface at a time. -.It Nm MT-Safe -Indicates that the interface is not only safe for concurrent use, but is -designed for such use. For example, a -.Nm Safe -interface may make use of a global lock to provide safety, but at reduced -internal concurrency, whereas an -.Nm MT-Safe -interface will be designed to be efficient even when used concurrently. -.It Nm Async-Signal-Safe -Indicates that the library is safe for use within a signal handler. An -.Nm MT-Safe -interface can be made -.Nm Async-Signal-Safe -by ensuring that it blocks signals when acquiring locks. -.It Nm Safe with Exceptions -As for -.Nm Safe -but with specific exceptions noted. -.It Nm MT-Safe with Exceptions -As for -.Nm MT-Safe -but with specific exceptions noted. -.El -.It Em SECURITY -Documents any security precautions that operators should consider. .It Em SEE ALSO References other manuals with related topics. This section should exist for most manuals. @@ -540,6 +426,8 @@ in this section. .It Em BUGS Known bugs, limitations, and work-arounds should be described in this section. +.It Em SECURITY CONSIDERATIONS +Documents any security precautions that operators should consider. .El .Sh MACRO OVERVIEW This overview is sorted such that macros of similar purpose are listed @@ -549,8 +437,8 @@ in the alphabetical .Sx MACRO REFERENCE . .Ss Document preamble and NAME section macros .Bl -column "Brq, Bro, Brc" description -.It Sx \&Dd Ta document date: Ar month day , year -.It Sx \&Dt Ta document title: Ar TITLE SECTION Op Ar arch +.It Sx \&Dd Ta document date: Cm $\&Mdocdate$ | Ar month day , year +.It Sx \&Dt Ta document title: Ar TITLE section Op Ar arch .It Sx \&Os Ta operating system version: Op Ar system Op Ar version .It Sx \&Nm Ta document name (one argument) .It Sx \&Nd Ta document description (one line) @@ -949,7 +837,7 @@ which resolves to .Sy 6n . .It A scaling width as described in -.Xr mandoc_roff 5 . +.Xr roff 7 . .It An arbitrary string, which indents by the length of this string. .El @@ -1058,7 +946,7 @@ arguments accept macro names as described for .Sx \&Bd .Fl offset , scaling widths as described in -.Xr mandoc_roff 5 , +.Xr roff 7 , or use the length of the given string. The .Fl offset @@ -1088,7 +976,7 @@ The .Fl width argument has no effect; instead, each argument specifies the width of one column, using either the scaling width syntax described in -.Xr mandoc_roff 5 +.Xr roff 7 or the string length of the argument. If the first line of the body of a .Fl column @@ -1261,9 +1149,10 @@ See also and .Sx \&Ox . .Ss \&Cd -Kernel configuration declaration. It is found in pages for -.Bx -and not used here. +Kernel configuration declaration. +This denotes strings accepted by +.Xr config 8 . +It is most often used in section 4 manual pages. .Pp Examples: .Dl \&.Cd device le0 at scode? @@ -1343,7 +1232,7 @@ the special string can be given as an argument. .It The traditional, purely numeric -.Xr man 5 +.Xr man 7 format .Ar year Ns \(en Ns Ar month Ns \(en Ns Ar day is accepted, too. @@ -1369,7 +1258,7 @@ invocations. It is followed by a newline. .Pp Examples: -.Dl \&.Dl % mandoc mdoc.5 \e(ba less +.Dl \&.Dl % mandoc mdoc.7 \e(ba less .Pp See also .Sx \&Ql , @@ -1428,17 +1317,51 @@ The document's title (name), defaulting to if unspecified. To achieve a uniform appearance of page header lines, it should by convention be all caps. -.It Ar SECTION +.It Ar section The manual section. +This may be one of +.Cm 1 +.Pq General Commands , +.Cm 2 +.Pq System Calls , +.Cm 3 +.Pq Library Functions , +.Cm 3p +.Pq Perl Library , +.Cm 4 +.Pq Device Drivers , +.Cm 5 +.Pq File Formats , +.Cm 6 +.Pq Games , +.Cm 7 +.Pq Miscellaneous Information , +.Cm 8 +.Pq System Manager's Manual , +or +.Cm 9 +.Pq Kernel Developer's Manual . It should correspond to the manual's filename suffix and defaults to the empty string if unspecified. -This field is optional. -To achieve a uniform appearance of page header lines, -it should by convention be all caps. .It Ar arch This specifies the machine architecture a manual page applies to, -where relevant. +where relevant, for example +.Cm alpha , +.Cm amd64 , +.Cm i386 , +or +.Cm sparc64 . +The list of valid architectures varies by operating system. .El +.Pp +Examples: +.Dl \&.Dt FOO 1 +.Dl \&.Dt FOO 9 i386 +.Pp +See also +.Sx \&Dd +and +.Sx \&Os . .Ss \&Dv Defined variables such as preprocessor constants, constant symbols, enumeration values, and so on. @@ -1580,7 +1503,7 @@ It takes two arguments, defining the delimiters to be used by subsequent macros. .Ss \&Ev Environmental variables such as those specified in -.Xr environ 5 . +.Xr environ 7 . .Pp Examples: .Dl \&.Ev DISPLAY @@ -1592,7 +1515,7 @@ for general constants. .Ss \&Ex Insert a standard sentence regarding command exit values of 0 on success and >0 on failure. -This is most often used in section 1 and 1M manual pages. +This is most often used in section 1, 6, and 8 manual pages. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Ex Fl std Op Ar utility ... @@ -1958,7 +1881,7 @@ section as described in .Pp Examples: .Dl \&.Lb libz -.Dl \&.Lb mdoc +.Dl \&.Lb libmandoc .Ss \&Li Denotes text that should be in a .Li literal @@ -2033,8 +1956,8 @@ arguments and will display macros verbatim. See also .Sx \&Nm . .Ss \&Nm -The name of the manual page, or \(em in particular in section 1 -pages \(em of an additional command or feature documented in +The name of the manual page, or \(em in particular in section 1, 6, +and 8 pages \(em of an additional command or feature documented in the manual page. When first invoked, the .Sx \&Nm @@ -2150,7 +2073,7 @@ Optional part of a command line. Prints the argument(s) in brackets. This is most often used in the .Em SYNOPSIS -section of section 1 and 1M manual pages. +section of section 1 and 8 manual pages. .Pp Examples: .Dl \&.Op \&Fl a \&Ar b @@ -2229,7 +2152,7 @@ is used as a default. .Pp Examples: .Dl \&.Pa /usr/bin/mandoc -.Dl \&.Pa /usr/share/man/man5/mdoc.5 +.Dl \&.Pa /usr/share/man/man7/mdoc.7 .Pp See also .Sx \&Lk . @@ -2785,7 +2708,7 @@ macro or the body of a partial-implicit block macro beyond the end of the input line. This macro originally existed to work around the 9-argument limit of historic -.Xr mandoc_roff 5 . +.Xr roff 7 . .Ss \&Xr Link to another manual .Pq Qq cross-reference . @@ -2823,7 +2746,7 @@ Its syntax is as follows: The .Ar height argument is a scaling width as described in -.Xr mandoc_roff 5 . +.Xr roff 7 . If unspecified, .Sx \&sp asserts a single vertical space. @@ -3209,11 +3132,11 @@ macros. Whenever any .Nm macro switches the -.Xr mandoc_roff 5 +.Xr roff 7 font mode, it will automatically restore the previous font when exiting its scope. Manually switching the font using the -.Xr mandoc_roff 5 +.Xr roff 7 .Ql \ef font escape sequences is never required. .Sh COMPATIBILITY @@ -3289,11 +3212,11 @@ but produces large indentations. .Sh SEE ALSO .Xr man 1 , .Xr mandoc 1 , -.Xr eqn 5 , -.Xr man 5 , -.Xr mandoc_char 5 , -.Xr mandoc_roff 5 , -.Xr tbl 5 +.Xr eqn 7 , +.Xr man 7 , +.Xr mandoc_char 7 , +.Xr roff 7 , +.Xr tbl 7 .Sh HISTORY The .Nm diff --git a/bin/mandoc/mandoc_roff.5 b/bin/mandoc/roff.7 similarity index 98% rename from bin/mandoc/mandoc_roff.5 rename to bin/mandoc/roff.7 index 471c82e5ce..114f63eddd 100644 --- a/bin/mandoc/mandoc_roff.5 +++ b/bin/mandoc/roff.7 @@ -16,7 +16,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: September 24 2015 $ -.Dt MANDOC_ROFF 5 +.Dt ROFF 7 .Os .Sh NAME .Nm roff @@ -26,16 +26,16 @@ The .Nm roff language is a general purpose text formatting language. Since traditional implementations of the -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 manual formatting languages are based on it, many real-world manuals use small numbers of .Nm requests and escape sequences intermixed with their -.Xr mdoc 5 +.Xr mdoc 7 or -.Xr man 5 +.Xr man 7 code. To properly format such manuals, the .Xr mandoc 1 @@ -47,9 +47,9 @@ Only these requests and escapes supported by are documented in the present manual, together with the basic language syntax shared by .Nm , -.Xr mdoc 5 , +.Xr mdoc 7 , and -.Xr man 5 . +.Xr man 7 . For complete .Nm manuals, consult the @@ -80,7 +80,7 @@ Lines not beginning with control characters are called They provide free-form text to be printed; the formatting of the text depends on the respective processing context. .Sh LANGUAGE SYNTAX -.Nm roff +.Nm documents may contain only graphable 7-bit ASCII characters, the space character, and, in certain circumstances, the tab character. The backslash character @@ -137,7 +137,7 @@ One-letter backslash escape. .El .Pp See -.Xr mandoc_char 5 +.Xr mandoc_char 7 for a complete list. .Ss Text Decoration Terms may be text-decorated using the @@ -167,7 +167,7 @@ Write in \f(BIbold italic\fP, then return to previous font mode. Text decoration is .Em not recommended for -.Xr mdoc 5 , +.Xr mdoc 7 , which encourages semantic annotation. .Ss Predefined Strings Predefined strings, like @@ -195,7 +195,7 @@ as they differ across implementations. Those supported by .Xr mandoc 1 are listed in -.Xr mandoc_char 5 . +.Xr mandoc_char 7 . Manuals using these predefined strings are almost certainly not portable. .Ss Whitespace Whitespace consists of the space character. @@ -280,10 +280,10 @@ Examples: .Bl -tag -width ".Bl -tag -width 2i" -offset indent -compact .It Li \&.Bl -tag -width 2i two-inch tagged list indentation in -.Xr mdoc 5 +.Xr mdoc 7 .It Li \&.HP 2i two-inch tagged list indentation in -.Xr man 5 +.Xr man 7 .It Li \&.sp 2v two vertical spaces .El @@ -337,9 +337,9 @@ Thus, the following request lines are all equivalent: .Ed .Sh MACRO SYNTAX Macros are provided by the -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 languages and can be defined by the .Sx \&de request. @@ -493,9 +493,9 @@ This is a Heirloom extension and currently unsupported. .Ss \&br Break the output line. See -.Xr man 5 +.Xr man 7 and -.Xr mdoc 5 . +.Xr mdoc 7 . .Ss \&break Break out of a .Sx \&while @@ -616,9 +616,9 @@ characters terminating each line, optionally containing calls to requests, .Nm macros or high-level macros like -.Xr man 5 +.Xr man 7 or -.Xr mdoc 5 +.Xr mdoc 7 macros, whichever applies to the document in question. .Pp Specifying a custom @@ -800,7 +800,7 @@ H SYNOPSIS invokes the .Cm SH macro when used in a -.Xr man 5 +.Xr man 7 document. Such abuse is of course strongly discouraged. .Ss \&ds1 @@ -860,7 +860,7 @@ This is a Heirloom extension and currently unsupported. .Ss \&EQ Begin an equation block. See -.Xr eqn 5 +.Xr eqn 7 for a description of the equation language. .Ss \&errprint Print a string like an error message. @@ -899,9 +899,9 @@ This is a Heirloom extension and currently ignored. .Ss \&fi Switch to fill mode. See -.Xr man 5 . +.Xr man 7 . Ignored in -.Xr mdoc 5 . +.Xr mdoc 7 . .Ss \&fkern Control the use of kerning tables for a font. This is a Heirloom extension and currently ignored. @@ -952,7 +952,7 @@ switches back to the previous font .Pp This request takes effect only locally, may be overridden by macros and escape sequences, and is only supported in -.Xr man 5 +.Xr man 7 for now. .Ss \&ftr Translate font name. @@ -1191,9 +1191,9 @@ request are discarded. .Ss \&in Change indentation. See -.Xr man 5 . +.Xr man 7 . Ignored in -.Xr mdoc 5 . +.Xr mdoc 7 . .Ss \&index Find a substring in a string. This is a Heirloom extension and currently unsupported. @@ -1273,7 +1273,7 @@ Its syntax is as follows: If the .Ar width argument is omitted, the line length is reset to its previous value. -The default setting for terminal output is 58n. +The default setting for terminal output is 78n. If a sign is given, the line length is added to or subtracted from; otherwise, it is set to the provided value. Using this request in new manuals is discouraged for several reasons, @@ -1326,9 +1326,9 @@ Currently ignored. .Ss \&nf Switch to no-fill mode. See -.Xr man 5 . +.Xr man 7 . Ignored by -.Xr mdoc 5 . +.Xr mdoc 7 . .Ss \&nh Turn off automatic hyphenation mode. Currently ignored. @@ -1366,7 +1366,7 @@ is handled specially: .Bl -tag -width Ds .It Cm nS If set to a positive integer value, certain -.Xr mdoc 5 +.Xr mdoc 7 macros will behave in the same way as in the .Em SYNOPSIS section. @@ -1376,7 +1376,7 @@ section, even when called within the .Em SYNOPSIS section itself. Note that starting a new -.Xr mdoc 5 +.Xr mdoc 7 section with the .Cm \&Sh macro will reset this register. @@ -1650,7 +1650,7 @@ This is a groff extension and currently ignored. .Ss \&TS Begin a table, which formats input in aligned rows and columns. See -.Xr tbl 5 +.Xr tbl 7 for a description of the tbl language. .Ss \&uf Globally set the underline font. @@ -1729,7 +1729,7 @@ Each number may be followed by one optional scaling unit described below .Sx Scaling Widths . The following equations hold: .Bd -literal -offset indent -1i = 6v = 6P = 10m = 10n = 52p = 1000M = 240u = 240 +1i = 6v = 6P = 10m = 10n = 72p = 1000M = 240u = 240 254c = 100i = 24000u = 24000 1f = 65536u = 65536 .Ed @@ -1792,9 +1792,9 @@ Note that the language defines more escape sequences not implemented in .Xr mandoc 1 . In -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 documents, using escape sequences is discouraged except for those described in the .Sx LANGUAGE SYNTAX @@ -1827,7 +1827,7 @@ instead. .Ss \e( Ns Ar cc .Sx Special Characters with two-letter names, see -.Xr mandoc_char 5 . +.Xr mandoc_char 7 . .Ss \e*[ Ns Ar name ] Interpolate the string with the .Ar name ; @@ -1851,7 +1851,7 @@ Right italic correction (groff extension); ignored by .Ss \e[ Ns Ar name ] .Sx Special Characters with names of arbitrary length, see -.Xr mandoc_char 5 . +.Xr mandoc_char 7 . .Ss \e^ One-twelfth em half-narrow space character, effectively zero-width in .Xr mandoc 1 . @@ -2099,15 +2099,15 @@ The special semantics of the number register is an idiosyncracy of .Ox manuals and not supported by other -.Xr mdoc 5 +.Xr mdoc 7 implementations. .Sh SEE ALSO .Xr mandoc 1 , -.Xr eqn 5 , -.Xr man 5 , -.Xr mandoc_char 5 , -.Xr mdoc 5 , -.Xr tbl 5 +.Xr eqn 7 , +.Xr man 7 , +.Xr mandoc_char 7 , +.Xr mdoc 7 , +.Xr tbl 7 .Rs .%A Joseph F. Ossanna .%A Brian W. Kernighan diff --git a/bin/mandoc/tbl.5 b/bin/mandoc/tbl.7 similarity index 96% rename from bin/mandoc/tbl.5 rename to bin/mandoc/tbl.7 index d0238e4154..c8fa8e4844 100644 --- a/bin/mandoc/tbl.5 +++ b/bin/mandoc/tbl.7 @@ -16,7 +16,7 @@ .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd $Mdocdate: January 29 2015 $ -.Dt TBL 5 +.Dt TBL 7 .Os .Sh NAME .Nm tbl @@ -26,9 +26,9 @@ The .Nm tbl language is a table-formatting language. It is used within -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 .Ux manual pages. This manual describes the subset of the @@ -38,15 +38,15 @@ language accepted by the utility. .Pp Tables within -.Xr mdoc 5 +.Xr mdoc 7 or -.Xr man 5 +.Xr man 7 are enclosed by the .Sq TS and .Sq TE macro tags, whose precise syntax is documented in -.Xr mandoc_roff 5 . +.Xr roff 7 . Tables consist of a series of options on a single line, followed by the table layout, followed by data. .Pp @@ -75,7 +75,7 @@ Tables are enclosed by the .Sq TS and .Sq TE -.Xr mandoc_roff 5 +.Xr roff 7 macros. A table consists of an optional single line of table .Sx Options @@ -100,10 +100,10 @@ Table data is that is, data rows are parsed then inserted into the underlying stream of input data. This allows data rows to be interspersed by arbitrary -.Xr mandoc_roff 5 , -.Xr mdoc 5 , +.Xr roff 7 , +.Xr mdoc 7 , and -.Xr man 5 +.Xr man 7 macros such as .Bd -literal -offset indent \&.TS @@ -117,7 +117,7 @@ c c c. .Ed .Pp in the case of -.Xr mdoc 5 +.Xr mdoc 7 or .Bd -literal -offset indent \&.TS @@ -131,7 +131,7 @@ c c c. .Ed .Pp in the case of -.Xr man 5 . +.Xr man 7 . .Ss Options The first line of a table may contain options separated by spaces, tabs, or commas and terminated by a semicolon. @@ -161,7 +161,7 @@ layout key. This is a GNU extension. .It Cm delim Use the two characters of the argument as -.Xr eqn 5 +.Xr eqn 7 delimiters. Currently unsupported. .It Cm doublebox @@ -261,7 +261,7 @@ modifier. .It Cm f The next character selects the font to use for this column. See the -.Xr mandoc_roff 5 +.Xr roff 7 manual for supported one-character font names. .It Cm i Use an italic font for the contents of this column. @@ -333,18 +333,18 @@ The implementation of .Nm doesn't support -.Xr mdoc 5 +.Xr mdoc 7 and -.Xr man 5 +.Xr man 7 macros and -.Xr eqn 5 +.Xr eqn 7 equations inside tables. .Sh SEE ALSO .Xr mandoc 1 , -.Xr man 5 , -.Xr mandoc_char 5 , -.Xr mandoc_roff 5 , -.Xr mdoc 5 +.Xr man 7 , +.Xr mandoc_char 7 , +.Xr mdoc 7 , +.Xr roff 7 .Rs .%A M. E. Lesk .%T Tbl\(emA Program to Format Tables diff --git a/exception_lists/packaging b/exception_lists/packaging index 2f3433abca..4878b45b7b 100644 --- a/exception_lists/packaging +++ b/exception_lists/packaging @@ -618,12 +618,6 @@ usr/lib/libvrrpadm.so usr/lib/amd64/libvrrpadm.so i386 usr/lib/sparcv9/libvrrpadm.so sparc # -# This is only used during the -t tools build -# -opt/onbld/bin/i386/mandoc i386 -opt/onbld/bin/sparc/mandoc sparc - -# # Private libdwarf # opt/onbld/lib/i386/libdwarf.so i386 diff --git a/share/man/man1/Makefile b/share/man/man1/Makefile index bc4c7e1e9f..e4753e16ce 100644 --- a/share/man/man1/Makefile +++ b/share/man/man1/Makefile @@ -6,7 +6,6 @@ MAN = acctcom.1 \ amt.1 \ appcert.1 \ apptrace.1 \ - apropos.1 \ ar.1 \ asa.1 \ at.1 \ @@ -195,7 +194,6 @@ MAN = acctcom.1 \ madv.so.1.1 \ mail.1 \ mailx.1 \ - man.1 \ mcs.1 \ mdb.1 \ mesg.1 \ @@ -369,7 +367,6 @@ MAN = acctcom.1 \ zonename.1 MLINKS+= Intro.1 intro.1 -MLINKS+= apropos.1 whatis.1 MLINKS+= alias.1 unalias.1 MLINKS+= at.1 batch.1 MLINKS+= awk.1 nawk.1 diff --git a/share/man/man1/apropos.1 b/share/man/man1/apropos.1 deleted file mode 100644 index 2ef316cbe5..0000000000 --- a/share/man/man1/apropos.1 +++ /dev/null @@ -1,130 +0,0 @@ -.\" Copyright 2014 Garrett D'Amore -.\" Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.Dd "Jul 20, 2014" -.Dt APROPOS 1 -.Os -.Sh NAME -.Nm apropos, whatis -.Nd locate commands by keyword lookup -.Sh SYNOPSIS -.Nm apropos -.Op Fl M Ar path -.Op Fl s Ar section -.Ar keyword ... -.Nm whatis -.Op Fl M Ar path -.Op Fl s Ar section -.Ar keyword ... -.Sh DESCRIPTION -The -.Nm apropos -utility displays the man page name, section number, and a -short description for each man page whose -.Em NAME -line contains -.Ar keyword . -This information is contained in the -.Nm whatis -database created by the -.Fl w -option used with -.Xr man 1 . -If this database is not present, -.Nm apropos -and -.Nm whatis -fail. -.Lp -Each word is considered -separately and the case of letters is ignored. Words which are part of other -words are considered; for example, when looking for -.Sq compile , -.Nm apropos -finds all instances of -.Sq compiler -also. -.Lp -The -.Nm whatis -command performs the same search, but only matches whole words. In the above -example, -.Nm whatis -would not match the instances of -.Sq compiler -when -.Ar keyword -is -.Sq compile . -.Lp -The -.Nm apropos -command is actually just the -.Fl k -option to the -.Xr man 1 -command. -.Sh OPTIONS -.Bl -tag -width "-s section" -.It Fl M Ar path -Force a specific colon separated manual path instead of the -default search path. Overrides the MANPATH environment variable. -.It Fl s Ar section -Restrict search to specified section. -.El -.Sh ENVIRONMENT -.Bl -tag -width "MANPATH, PATH" -.It Ev MANPATH , PATH -Used to find the location of the -.Nm whatis -database. -.El -.Sh FILES -.Bl -tag -width "/usr/share/man/whatis" -.It Pa /usr/share/man/whatis -table of contents and keyword database -.El -.Sh EXAMPLES -.Ss Example 1 To find a man page whose NAME line contains a keyword -Try -.Lp -.Dl example% apropos password -.Lp -If the line starts -.So Ar filename Ns Po Ar section Pc .\|.\|. Sc -you can run -.Lp -.Dl % Nm man Fl s Ar section Ar filename -.Lp -to display the man page for \fIfilename\fR. -.Ss Example 2 To find the man page for the subroutine \fBprintf() -Try -.Lp -.Dl example% Nm apropos Li format -.Lp -and then -.Lp -.Dl example% Nm man Fl s Ar 3C Li printf -.Lp -to get the manual page on the subroutine -.Xr printf 3C . -.Sh DIAGNOSTICS -.Bl -tag -width Ds -.It "/usr/share/man/whatis: No such file or directory" -The -.Nm whatis -database does not exist. -The command -.Nm man -.Fl w -must be run to create it. -.El -.Sh CODE SET INDEPENDENCE -Enabled. -.Sh INTERFACE STABILITY -.Nm Committed . -.Sh SEE ALSO -.Xr man 1 , -.Xr catman 1M diff --git a/share/man/man1/man.1 b/share/man/man1/man.1 deleted file mode 100644 index a10b88bade..0000000000 --- a/share/man/man1/man.1 +++ /dev/null @@ -1,422 +0,0 @@ -.\" -.\" The Berkeley software License Agreement specifies the terms and conditions -.\" for redistribution. -.\" -.\" -.\" Copyright (c) 1980 Regents of the University of California. -.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. -.\" Copyright 2014 Garrett D'Amore -.\" Copyright 2016 Nexenta Systems, Inc. -.\" -.Dd February 12, 2016 -.Dt MAN 1 -.Os -.Sh NAME -.Nm man -.Nd find and display reference manual pages -.Sh SYNOPSIS -.Nm -.Op Fl -.Op Fl adFlrt -.Op Fl T Ar macro-package -.Op Fl M Ar path -.Op Fl s Ar section -.Ar name ... -.Nm -.Op Fl M Ar path -.Op Fl s Ar section -.Fl k -.Ar keyword -.Ar ... -.Nm -.Op Fl M Ar path -.Op Fl s Ar section -.Fl f -.Ar -.Nm -.Op Fl M Ar path -.Fl w -.Sh DESCRIPTION -The -.Nm -command displays information from the reference manuals. It -displays complete manual pages that you select by -.Ar name , -or one-line summaries selected either by -.Ar keyword -.Pq Fl k , -or by the name of an associated file -.Pq Fl f . -If no manual page is located, -.Nm -prints an error message. -.Ss "Source Format" -Reference Manual pages are marked up with either -.Xr man 5 , -or -.Xr mdoc 5 -language tags. The -.Nm -command recognizes the type of markup and -processes the file accordingly. -. -.Ss "Location of Manual Pages" -. -The online Reference Manual page directories are conventionally located in -.Pa /usr/share/man . -Each directory corresponds to a -section of the manual. Since these directories are optionally installed, they -might not reside on your host. You might have to mount -.Pa /usr/share/man -from a host on which they do reside. -The -.Nm -command reformats a page whenever it is requested. -.Pp -If the standard output is not a terminal, or if the -.Fl -flag is given, -.Nm -pipes its output through -.Xr cat 1 . -Otherwise, -.Nm -pipes its output through a pager such as -.Xr more 1 -to handle paging and underlining on the screen. -.Sh OPTIONS -The following options are supported: -.Bl -tag -width indent -.It Fl a -Shows all manual pages matching -.Ar name -within the -.Ev MANPATH -search path. Manual pages are displayed in the order found. -.It Fl d -Debugs. Displays what a section-specifier evaluates to, method used for -searching, and paths searched by -.Nm . -.It Fl f Ar file ... -Attempts to locate manual pages related to any of the given -.Ar file -names. It strips the leading path name components from each -.Ar file , -and then prints one-line summaries containing the resulting basename or names. -This option also uses the -.Pa whatis -database. -.It Fl F -This option is present for backwards compatibility and is documented -here for reference only. It performs no function. -.It Fl k Ar keyword ... -Prints out one-line summaries from the -.Pa whatis -database (table of contents) that contain any of the given -.Ar keyword . -The -.Pa whatis -database is created using the -.Fl w -option. -.It Fl l -Lists all manual pages found matching -.Ar name -within the search path. -.It Fl M Ar path -Specifies an alternate search path for manual pages. The -.Ar path -is a colon-separated list of directories that contain manual page directory -subtrees. For example, if -.Ar path -is -.Pa /usr/share/man:/usr/local/man , -.Nm -searches for -.Ar name -in the standard location, and then -.Pa /usr/local/man . -When used with the -.Fl k , -.Fl f , -or -.Fl w -options, the -.Fl M -option must appear first. Each directory in the -.Ar path -is assumed to contain subdirectories of the form -.Pa man* , -one for each section. This option overrides the -.Ev MANPATH -environment variable. -.It Fl r -Reformats the manual page, checking for formatting errors, but does not -display it. -.It Fl s Ar section -Specifies sections of the manual for -.Nm -to search. The directories searched for -.Ar name -are limited to those specified by -.Ar section . -.Ar section -can be a numerical digit, perhaps followed by one or more letters -to match the desired section of the manual, for example, -.Li "3elf". -Also, -.Ar section -can be a word, for example, -.Li local , -.Li new , -.Li old , -.Li public . -.Ar section -can also be a letter. To specify multiple sections, -separate each section with a comma. This option overrides the -.Ev MANPATH -environment variable and the -.Pa man.cf -file. See -.Sx Search Path -below for an explanation of how -.Nm -conducts its search. -.It Fl t -Arranges for the specified manual pages to be sent to the default -printer as PostScript. -.It Fl T Ar macro-package -This option is present for backwards compatibility and is documented -here for reference only. It performs no function. -.It Fl w -Updates the -.Nm whatis -database. -.El -.Sh OPERANDS -The following operand is supported: -.Bl -tag -width indent -.It Ar name -The name of a standard utility or a keyword. -.El -.Sh USAGE -The usage of -.Nm -is described below: -. -.Ss "Manual Page Sections" -. -Entries in the reference manuals are organized into -.Em sections . -A section -name consists of a major section name, typically a single digit, optionally -followed by a subsection name, typically one or more letters. An unadorned -major section name, for example, -.Qq 9 , -does not act as an abbreviation for -the subsections of that name, such as -.Qq 9e , -.Qq 9f , -or -.Qq 9s . -That is, each subsection must be searched separately by -.Nm -.Fl s . -Each section contains descriptions apropos to a particular reference category, -with subsections refining these distinctions. See the -.Em intro -manual pages for an explanation of the classification used in this release. -. -.Ss "Search Path" -. -Before searching for a given -.Ar name , -.Nm -constructs a list of candidate directories and sections. -It searches for -.Ar name -in the directories specified by the -.Ev MANPATH -environment variable. -.Lp -In the absence of -.Ev MANPATH , -.Nm -constructs its search path based upon the -.Ev PATH -environment variable, primarily by substituting -.Li man -for the last component of the -.Ev PATH -element. Special provisions are added -to account for unique characteristics of directories such as -.Pa /sbin , -.Pa /usr/xpg4/bin , -and others. If the file argument contains -a -.Qq / -character, the -.Em dirname -portion of the argument is used in place of -.Ev PATH -elements to construct the search path. -.Lp -Within the manual page directories, -.Nm -confines its search to the -sections specified in the following order: -.Bl -bullet -.It -.Ar sections -specified on the command line with the -.Fl s -option -.It -.Ar sections -embedded in the -.Ev MANPATH -environment variable -.It -.Ar sections -specified in the -.Pa man.cf -file for each directory specified in the -.Ev MANPATH -environment variable -.El -If none of the above exist, -.Nm -searches each directory in the manual -page path, and displays the first matching manual page found. -.Lp -The -.Pa man.cf -file has the following format: -.Lp -.Dl Pf MANSECTS= Ar section Ns Oo , Ns Ar section Oc Ns ... -.Lp -Lines beginning with -.Sq Li # -and blank lines are considered comments, and are -ignored. Each directory specified in -.Ev MANPATH -can contain a manual page -configuration file, specifying the default search order for that directory. -.Sh "Referring to Other Manual Pages" -If the first line of the manual page is a reference to another manual -page entry fitting the pattern: -.Lp -.Dl \&.so man*/ Ns Em sourcefile -.Lp -.Nm -processes the indicated file in place of the current one. The -reference must be expressed as a path name relative to the root of the manual -page directory subtree. -.Lp -When the second or any subsequent line starts with -.Sy \&.so , -.Nm -ignores it; -.Xr troff 1 -or -.Xr nroff 1 -processes the request in the usual manner. -.Sh ENVIRONMENT VARIABLES -See -.Xr environ 5 -for descriptions of the following environment variables -that affect the execution of -.Nm man : -.Ev LANG , -.Ev LC_ALL , -.Ev LC_CTYPE , -.Ev LC_MESSAGES , -and -.Ev NLSPATH . -.Bl -tag -width MANWIDTH -.It Ev MANPATH -A colon-separated list of directories; each directory can be followed by a -comma-separated list of sections. If set, its value overrides -.Pa /usr/share/man -as the default directory search path, and the -.Pa man.cf -file as the default section search path. The -.Fl M -and -.Fl s -flags, in turn, override these values. -.It Ev MANWIDTH -Width of the output. If set to the special value -.Qq Sy TTY -.Po or -.Qq Sy tty -.Pc , -and output is to terminal, auto-detect terminal width. -.It Ev PAGER -A program to use for interactively delivering -output to the screen. If not set, -.Sq Nm more Fl s -is used. See -.Xr more 1 . -.El -.Sh FILES -.Bl -tag -width indent -.It Pa /usr/share/man -Root of the standard manual page directory subtree -.It Pa /usr/share/man/man?/* -Unformatted manual entries -.It Pa /usr/share/man/whatis -Table of contents and keyword database -.It Pa man.cf -Default search order by section -.El -.Sh EXIT STATUS -.Ex -std man -.Sh EXAMPLES -. -.Ss Example 1: Creating a PostScript Version of a man page -. -The following example spools the -.Xr pipe 2 -man page in PostScript to the default printer: -.Pp -.Dl % man -t -s 2 pipe -.Pp -Note that -.Xr mandoc 1 -can be used to obtain the PostScript content directly. -.Ss Example 2: Creating a Text Version of a man page -The following example creates the -.Xr pipe 2 -man page in ASCII text: -.Pp -.Dl % man pipe.2 | col -x -b > pipe.text -.Sh CODE SET INDEPENDENCE -Enabled. -.Sh INTERFACE STABILITY -.Sy Committed . -.Sh SEE ALSO -.Xr apropos 1 , -.Xr cat 1 , -.Xr col 1 , -.Xr mandoc 1 , -.Xr more 1 , -.Xr whatis 1 , -.Xr environ 5 , -.Xr man 5 , -.Xr mdoc 5 -.Sh NOTES -The -.Fl f -and -.Fl k -options use the -.Nm whatis -database, which is -created with the -.Fl w -option. -.Sh BUGS -The manual is supposed to be reproducible either on a phototypesetter or on an -ASCII terminal. However, on a terminal some information (indicated by -font changes, for instance) is lost. diff --git a/share/man/man1m/Makefile b/share/man/man1m/Makefile index a2e4f664be..6d0f10ffd5 100644 --- a/share/man/man1m/Makefile +++ b/share/man/man1m/Makefile @@ -49,7 +49,6 @@ MAN = 6to4relay.1m \ bootadm.1m \ busstat.1m \ captoinfo.1m \ - catman.1m \ cfgadm.1m \ cfgadm_ac.1m \ cfgadm_fp.1m \ diff --git a/share/man/man1m/catman.1m b/share/man/man1m/catman.1m deleted file mode 100644 index 5a79706553..0000000000 --- a/share/man/man1m/catman.1m +++ /dev/null @@ -1,72 +0,0 @@ -.\" -.\" This file and its contents are supplied under the terms of the -.\" Common Development and Distribution License ("CDDL"), version 1.0. -.\" You may only use this file in accordance with the terms of version -.\" 1.0 of the CDDL. -.\" -.\" A full copy of the text of the CDDL should have accompanied this -.\" source. A copy of the CDDL is also available via the Internet at -.\" http://www.illumos.org/license/CDDL. -.\" -.\" -.\" Copyright 2014 Garrett D'Amore -.\" -.Dd April 9, 2016 -.Dt CATMAN 1M -.Os -.Sh NAME -.Nm catman -.Nd generate -.Nm whatis -database files -.Sh SYNOPSIS -.Nm -.Op Fl M Ar path -.Op Fl w -.Sh DESCRIPTION -The -.Nm -utility generates a set of -.Nm whatis -database files suitable for use with -.Xr apropos 1 -and -.Xr whatis 1 . -It is supplied for compatibility reasons. The same databases can -be generated using the -.Fl w -option with -.Xr man 1 , -and that command should be used instead. -.Sh OPTIONS -.Bl -tag -width ".Fl d" -.It Fl M Ar path -Generate the -.Nm whatis -database files within the specified colon separated manual paths. -Overrides the -.Ev MANPATH -environment variable. -.It Fl w -This option is present for backwards compatibility, and is ignored. -.El -.Sh ENVIRONMENT -The following environment variables affect the execution of -.Nm : -.Bl -tag -width ".Ev MANPATH" -.It Ev MANPATH -Used to specify a colon separated list of manual paths within -which to generate -.Nm whatis -database files. -.El -.Sh EXIT STATUS -.Ex -std -.Sh INTERFACE STABILITY -.Nm "Obsolete Committed" . -.Sh CODE SET INDEPENDENCE -Enabled. -.Sh SEE ALSO -.Xr apropos 1 , -.Xr man 1 , -.Xr whatis 1 diff --git a/share/man/man5/Makefile b/share/man/man5/Makefile index 441d2e9532..c1c6bd1914 100644 --- a/share/man/man5/Makefile +++ b/share/man/man5/Makefile @@ -44,7 +44,6 @@ MAN = Intro.5 \ lfcompile.5 \ lfcompile64.5 \ locale.5 \ - man.5 \ me.5 \ mech_spnego.5 \ mm.5 \ diff --git a/share/man/man5/man.5 b/share/man/man5/man.5 deleted file mode 100644 index 0ed6910e33..0000000000 --- a/share/man/man5/man.5 +++ /dev/null @@ -1,255 +0,0 @@ -.\" Copyright 2015 Nexenta Systems, Inc. All rights reserved. -.\" Copyright 2014 Garrett D'Amore -.\" Copyright (c) 1995, Sun Microsystems, Inc. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.Dd "Feb 18, 2015" -.Dt MAN 5 -.Os -.Sh NAME -.Nm man -.Nd macros to format Reference Manual pages -.Sh SYNOPSIS -.Nm mandoc -.Fl T Ar man -.Ar -.Nm nroff -.Fl man -.Ar -.Nm troff -.Fl man -.Ar -.Sh DESCRIPTION -These macros are used to lay out the reference pages in this manual. Note: if -.Ar file -contains format input for a preprocessor, the commands shown -above must be piped through the appropriate preprocessor. This is handled -automatically by the -.Xr man 1 -command. See the -.Sx Conventions -section. -.Lp -Any text argument -.Ar t -may be zero to six words. Quotes may be used to -include SPACE characters in a -.Qq word . -If -.Ar text -is empty, the special -treatment is applied to the next input line with text to be printed. In this -way -.Nm \&.I -may be used to italicize a whole line, or -.Nm \&.SB -may be used to make small bold letters. -.Lp -A prevailing indent distance is remembered between successive indented -paragraphs, and is reset to default value upon reaching a non-indented -paragraph. Default units for indents -.Nm i -are ens. -.Lp -Type font and size are reset to default values before each paragraph, and after -processing font and size setting macros. -.Pp -These strings are predefined by -.Nm -man : -.Bl -tag -width Ds -.It Nm \e*R -.Sq \(rg , -.Sq (Reg) -in -.Nm nroff . -.It Nm \e*S -Change to default type size. -.El -.Sh "Requests" -* n.t.l. = next text line; p.i. = prevailing indent -.Bl -column ".TH n s d f m" "Cause " "t=n.t.l.*" "Explanation " -offset Ds -.It Sy Request Sy Cause Sy "If No" Sy Explanation -.It "" Sy Break Sy "Argument" "" -.It Nm \&.B Ar "t" no Ar t Ns =n.t.l.* Text is in bold font. -.It Nm \&.BI Ar t no Ar t Ns =n.t.l. Join words, alternating bold and italic. -.It Nm \&.BR Ar t no Ar t Ns =n.t.l. Join words, alternating bold and roman. -.It Nm \&.DT no Li \&.5i 1i... Restore default tabs. -.It Nm \&.HP Ar i yes Ar i Ns =p.i.* "Begin paragraph with hanging indent. Set prevailing indent to" Ar i . -.It Nm \&.I Ar t no Ar t Ns =n.t.l. Text is italic. -.It Nm \&.IB Ar t no Ar t Ns =n.t.l. Join words, altenrating italic and bold. -.It Nm \&.IP Ar x Ar i yes Ar x Ns ="" Same as -.Nm \&.TP -with tag -.Ar x . -.It Nm \&.IR Ar t no Ar t Ns =n.t.l. Join words, alternating italic and roman. -.It Nm \&.IX Ar t no - Index macro, not used (obsolete). -.It Nm \&.LP yes - Begin left-aligned paragraph. Set prevailing indent to .5i. -.It Nm \&.P yes - Same as -.Nm \&.LP . -.It Nm \&.PD Ar d no Ar d Ns =.4v Set vertical distance between paragraphs. -.It Nm \&.PP yes - Same as -.Nm \&.LP . -.It Nm \&.RE yes - End of relative indent. Restores prevailing indent. -.It Nm \&.RB Ar t no Ar t Ns =n.t.l. Join words, alternating roman and bold. -.It Nm \&.RI Ar t no Ar t Ns =n.t.l. Join words, alternating roman and italic. -.It Nm \&.RS Ar i yes Ar i Ns =p.i. Start relative indent, increase indent by Ar i . -Sets prevailing indent to .5i for nested indents. -.It Nm \&.SB Ar t no - Reduce size of text by 1 point, make text bold. -.It Nm \&.SH Ar t yes - Section Heading. -.It Nm \&.SM Ar t no Ar t Ns =n.t.l. Reduce size of text by 1 point. -.It Nm \&.SS Ar t yes Ar t Ns =n.t.l. Section Subheading. -.It Nm \&.TH Ar n s d f m yes - Begin reference page Ar n , No of section Ar s ; Ar d No is the date of the most recent change. If present, Ar f No is the left page footer; Ar m No is the main page (center) header. Sets prevailing indent and tabs to .5i. -.It Nm \&.TP Ar i yes Ar i Ns =p.i. Begin indented paragraph, with the tag given on the next text line. Set prevailing indent to -.Ar i . -.It Nm \&.TX Ar t p no - Resolve the title abbreviation Ar t ; No join to punctuation mark (or text) Ar p . -.El -.Ss "Conventions" -When formatting a manual page, -.Nm -examines the first line to determine -whether it requires special processing. For example a first line consisting of: -.Lp -.Dl \&'\e" t -.Lp -indicates that the manual page must be run through the -.Xr tbl 1 -preprocessor. -.Lp -A typical manual page for a command or function is laid out as follows: -.Bl -tag -width ".SH RETURN VALUES" -. -.It Nm \&.TH Ar title Op "1-9" -. -The name of the command or function, which serves as the title of the manual -page. This is followed by the number of the section in which it appears. -. -.It Nm \&.SH NAME -. -The name, or list of names, by which the command is called, followed by a dash -and then a one-line summary of the action performed. All in roman font, this -section contains no -.Xr troff 1 -commands or escapes, and no macro requests. -It is used to generate the database used by the -.Xr whatis 1 -command. -. -.It Nm \&.SH SYNOPSIS -.Bl -tag -width "Functions:" -.It Sy Commands: -The syntax of the command and its arguments, as typed on the command line. -When in boldface, a word must be typed exactly as printed. When in italics, a -word can be replaced with an argument that you supply. References to bold or -italicized items are not capitalized in other sections, even when they begin a -sentence. -.Lp -Syntactic symbols appear in roman face: -.Bl -tag -width " " -.It Op " " -An argument, when surrounded by brackets is optional. -.It | -Arguments separated by a vertical bar are exclusive. You can supply only one -item from such a list. -.It \&.\|.\|. -Arguments followed by an ellipsis can be repeated. When an ellipsis follows a -bracketed set, the expression within the brackets can be repeated. -.El -.It Sy Functions: -If required, the data declaration, or -.Li #include -directive, is shown first, -followed by the function declaration. Otherwise, the function declaration is -shown. -.El -. -.It Nm \&.SH DESCRIPTION -. -A narrative overview of the command or function's external behavior. This -includes how it interacts with files or data, and how it handles the standard -input, standard output and standard error. Internals and implementation details -are normally omitted. This section attempts to provide a succinct overview in -answer to the question, "what does it do?" -.Lp -Literal text from the synopsis appears in constant width, as do literal -filenames and references to items that appear elsewhere in the reference -manuals. Arguments are italicized. -.Lp -If a command interprets either subcommands or an input grammar, its command -interface or input grammar is normally described in a -.Nm USAGE -section, which follows the -.Nm OPTIONS -section. The -.Nm DESCRIPTION -section only -describes the behavior of the command itself, not that of subcommands. -. -.It Nm \&.SH OPTIONS -. -The list of options along with a description of how each affects the command's -operation. -. -.It Nm \&.SH RETURN VALUES -. -A list of the values the library routine will return to the calling program -and the conditions that cause these values to be returned. -. -.It Nm \&.SH EXIT STATUS -. -A list of the values the utility will return to the calling program or shell, -and the conditions that cause these values to be returned. -. -.It Nm \&.SH FILES -. -A list of files associated with the command or function. -. -.It Nm \&.SH SEE ALSO -. -A comma-separated list of related manual pages, followed by references to other -published materials. -. -.It Nm \&.SH DIAGNOSTICS -. -A list of diagnostic messages and an explanation of each. -. -.It Nm \&.SH BUGS -. -A description of limitations, known defects, and possible problems associated -with the command or function. -.El -.Sh FILES -.Pa /usr/share/man/whatis -.Sh NOTES -The -.Nm -package should not be used for new documentation. The -.Xr mdoc 5 , -package is preferred, as it uses semantic markup rather than physical markup. -.Sh CODE SET INDEPENDENCE -When processed with -.Xr mandoc 1 , -this package is Code Set Independent. However, when processed with -legacy tools such as -.Xr nroff 1 -and -.Xr troff 1 , -the use of multi-byte characters may not be supported. -.Sh INTERFACE STABILITY -.Sy Obsolete Committed . -The -.Xr mdoc 5 -package should be used instead. -.Sh SEE ALSO -.Xr eqn 1 , -.Xr man 1 , -.Xr mandoc 1 , -.Xr nroff 1 , -.Xr tbl 1 , -.Xr troff 1 , -.Xr whatis 1 , -.Xr mdoc 5 -.Rs -.%A Dale Dougherty and Tim O'Reilly -.%B Unix Text Processing -.Re diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs index 53d781de51..6eed93865f 100644 --- a/usr/src/Targetdirs +++ b/usr/src/Targetdirs @@ -460,7 +460,6 @@ SYM.DIRS= \ /usr/lib/link_audit/32 \ /usr/lib/secure/32 \ /usr/mail \ - /usr/man \ /usr/pub \ /usr/tmp \ /var/ld/32 @@ -551,7 +550,6 @@ $(ROOT)/dev/stdin:= LINKDEST=fd/0 $(ROOT)/dev/stdout:= LINKDEST=fd/1 $(ROOT)/dev/stderr:= LINKDEST=fd/2 $(ROOT)/usr/pub:= LINKDEST=share/lib/pub -$(ROOT)/usr/man:= LINKDEST=share/man $(ROOT)/usr/adm:= LINKDEST=../var/adm $(ROOT)/etc/lib/ld.so.1:= LINKDEST=../../lib/ld.so.1 $(ROOT)/etc/lib/libdl.so.1:= LINKDEST=../../lib/libdl.so.1 diff --git a/usr/src/cmd/Makefile b/usr/src/cmd/Makefile index 4306603cd4..62865ceb7b 100644 --- a/usr/src/cmd/Makefile +++ b/usr/src/cmd/Makefile @@ -248,7 +248,6 @@ COMMON_SUBDIRS= \ mailwrapper \ mailx \ make \ - man \ mdb \ mesg \ mkdir \ @@ -602,7 +601,6 @@ MSGSUBDIRS= \ luxadm \ mailx \ make \ - man \ mesg \ mkdir \ mkpwdict \ diff --git a/usr/src/cmd/man/Makefile b/usr/src/cmd/man/Makefile deleted file mode 100644 index 2d85ee6dc0..0000000000 --- a/usr/src/cmd/man/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2012 Nexenta Systems, Inc. All rights reserved. -# Copyright 2014 Garrett D'Amore -# - -PROG= man -LINKS= apropos whatis catman -LIBLINKS = makewhatis -OBJS= makewhatis.o man.o stringlist.o -SRCS= $(OBJS:%.o=%.c) - -include $(SRC)/cmd/Makefile.cmd - - -ROOTLINKS= $(LINKS:%=$(ROOTBIN)/%) $(LIBLINKS:%=$(ROOTLIB)/%) - -.KEEP_STATE : - -all: $(PROG) - -clean: - $(RM) $(OBJS) - -install: all $(ROOTPROG) $(ROOTLINKS) - - -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) - -$(ROOTLINKS): $(ROOTPROG) - $(RM) $@; $(LN) $(ROOTPROG) $@ - -include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/man/THIRDPARTYLICENSE b/usr/src/cmd/man/THIRDPARTYLICENSE deleted file mode 100644 index f6ba743968..0000000000 --- a/usr/src/cmd/man/THIRDPARTYLICENSE +++ /dev/null @@ -1,92 +0,0 @@ -man.c: - -Copyright (c) 1980 Regents of the University of California. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - 3. All advertising materials mentioning features or use of this - software must display the following acknowledgement: - This product includes software developed by the University - of California, Berkeley and its contributors. - 4. Neither the name of the University nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -makewhatis.c: - -Copyright (c) 2002 John Rochester -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer, - in this position and unchanged. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -stringlist.c, stringlist.h: - -Copyright (c) 1994 Christos Zoulas -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -4. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/usr/src/cmd/man/THIRDPARTYLICENSE.descrip b/usr/src/cmd/man/THIRDPARTYLICENSE.descrip deleted file mode 100644 index 3fe27c64b4..0000000000 --- a/usr/src/cmd/man/THIRDPARTYLICENSE.descrip +++ /dev/null @@ -1 +0,0 @@ -PORTIONS OF MAN COMMAND FUNCTIONALITY diff --git a/usr/src/cmd/man/makewhatis.c b/usr/src/cmd/man/makewhatis.c deleted file mode 100644 index c5428e4633..0000000000 --- a/usr/src/cmd/man/makewhatis.c +++ /dev/null @@ -1,837 +0,0 @@ -/* - * Copyright (c) 2002 John Rochester - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. - * Copyright 2014 Garrett D'Amore - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "man.h" -#include "stringlist.h" - - -/* Information collected about each man page in a section */ -struct page_info { - char *filename; - char *name; - char *suffix; - ino_t inode; -}; - -/* An expanding string */ -struct sbuf { - char *content; /* the start of the buffer */ - char *end; /* just past the end of the content */ - char *last; /* the last allocated character */ -}; - -/* Remove the last amount characters from the sbuf */ -#define sbuf_retract(sbuf, amount) ((sbuf)->end -= (amount)) -/* Return the length of the sbuf content */ -#define sbuf_length(sbuf) ((sbuf)->end - (sbuf)->content) - -typedef char *edited_copy(char *from, char *to, int length); - -/* - * While the whatis line is being formed, it is stored in whatis_proto. - * When finished, it is reformatted into whatis_final and then appended - * to whatis_lines. - */ -static struct sbuf *whatis_proto; -static struct sbuf *whatis_final; -static stringlist *whatis_lines; /* collected output lines */ - -static char tempfile[MAXPATHLEN]; /* path of temporary file, if any */ - -#define MDOC_COMMANDS "ArDvErEvFlLiNmPa" - - -/* Free a struct page_info and its content */ -static void -free_page_info(struct page_info *info) -{ - - free(info->filename); - free(info->name); - free(info->suffix); - free(info); -} - -/* - * Allocate and fill in a new struct page_info given the - * name of the man section directory and the dirent of the file. - * If the file is not a man page, return NULL. - */ -static struct page_info * -new_page_info(char *dir, struct dirent *dirent) -{ - struct page_info *info; - int basename_length; - char *suffix; - struct stat st; - - if ((info = malloc(sizeof (struct page_info))) == NULL) - err(1, "malloc"); - basename_length = strlen(dirent->d_name); - suffix = &dirent->d_name[basename_length]; - if (asprintf(&info->filename, "%s/%s", dir, dirent->d_name) == -1) - err(1, "asprintf"); - for (;;) { - if (--suffix == dirent->d_name || !isalnum(*suffix)) { - if (*suffix == '.') - break; - free(info->filename); - free(info); - return (NULL); - } - } - *suffix++ = '\0'; - info->name = strdup(dirent->d_name); - info->suffix = strdup(suffix); - if (stat(info->filename, &st) < 0) { - warn("%s", info->filename); - free_page_info(info); - return (NULL); - } - if (!S_ISREG(st.st_mode)) { - free_page_info(info); - return (NULL); - } - info->inode = st.st_ino; - return (info); -} - -/* - * Reset sbuf length to 0. - */ -static void -sbuf_clear(struct sbuf *sbuf) -{ - - sbuf->end = sbuf->content; -} - -/* - * Allocate a new sbuf. - */ -static struct sbuf * -new_sbuf(void) -{ - struct sbuf *sbuf; - - if ((sbuf = malloc(sizeof (struct sbuf))) == NULL) - err(1, "malloc"); - if ((sbuf->content = (char *)malloc(LINE_ALLOC)) == NULL) - err(1, "malloc"); - sbuf->last = sbuf->content + LINE_ALLOC - 1; - sbuf_clear(sbuf); - - return (sbuf); -} - -/* - * Ensure that there is enough room in the sbuf - * for nchars more characters. - */ -static void -sbuf_need(struct sbuf *sbuf, int nchars) -{ - char *new_content; - size_t size, cntsize; - size_t grow = 128; - - while (grow < nchars) { - grow += 128; /* we grow in chunks of 128 bytes */ - } - - /* Grow if the buffer isn't big enough */ - if (sbuf->end + nchars > sbuf->last) { - size = sbuf->last + 1 - sbuf->content; - size += grow; - cntsize = sbuf->end - sbuf->content; - - if ((new_content = realloc(sbuf->content, size)) == NULL) { - perror("realloc"); - if (tempfile[0] != '\0') - (void) unlink(tempfile); - exit(1); - } - sbuf->content = new_content; - sbuf->end = new_content + cntsize; - sbuf->last = new_content + size - 1; - } -} - -/* - * Append a string of a given length to the sbuf. - */ -static void -sbuf_append(struct sbuf *sbuf, const char *text, int length) -{ - if (length > 0) { - sbuf_need(sbuf, length); - (void) memcpy(sbuf->end, text, length); - sbuf->end += length; - } -} - -/* - * Append a null-terminated string to the sbuf. - */ -static void -sbuf_append_str(struct sbuf *sbuf, char *text) -{ - - sbuf_append(sbuf, text, strlen(text)); -} - -/* - * Append an edited null-terminated string to the sbuf. - */ -static void -sbuf_append_edited(struct sbuf *sbuf, char *text, edited_copy copy) -{ - int length; - - if ((length = strlen(text)) > 0) { - sbuf_need(sbuf, length); - sbuf->end = copy(text, sbuf->end, length); - } -} - -/* - * Strip any of a set of chars from the end of the sbuf. - */ -static void -sbuf_strip(struct sbuf *sbuf, const char *set) -{ - - while (sbuf->end > sbuf->content && strchr(set, sbuf->end[-1]) != NULL) - sbuf->end--; -} - -/* - * Return the null-terminated string built by the sbuf. - */ -static char * -sbuf_content(struct sbuf *sbuf) -{ - - *sbuf->end = '\0'; - return (sbuf->content); -} - -/* - * Return true if no man page exists in the directory with - * any of the names in the stringlist. - */ -static int -no_page_exists(char *dir, stringlist *names, char *suffix) -{ - char path[MAXPATHLEN]; - char *suffixes[] = { "", ".gz", ".bz2", NULL }; - size_t i; - int j; - - for (i = 0; i < names->sl_cur; i++) { - for (j = 0; suffixes[j] != NULL; j++) { - (void) snprintf(path, MAXPATHLEN, "%s/%s.%s%s", - dir, names->sl_str[i], suffix, suffixes[j]); - if (access(path, F_OK) == 0) { - return (0); - } - } - } - return (1); -} - -/* ARGSUSED sig */ -static void -trap_signal(int sig) -{ - - if (tempfile[0] != '\0') - (void) unlink(tempfile); - - exit(1); -} - -/* - * Attempt to open an output file. - * Return NULL if unsuccessful. - */ -static FILE * -open_output(char *name) -{ - FILE *output; - - whatis_lines = sl_init(); - (void) snprintf(tempfile, MAXPATHLEN, "%s.tmp", name); - name = tempfile; - if ((output = fopen(name, "w")) == NULL) { - warn("%s", name); - return (NULL); - } - return (output); -} - -static int -linesort(const void *a, const void *b) -{ - - return (strcmp((*(const char * const *)a), (*(const char * const *)b))); -} - -/* - * Write the unique sorted lines to the output file. - */ -static void -finish_output(FILE *output, char *name) -{ - size_t i; - char *prev = NULL; - - qsort(whatis_lines->sl_str, whatis_lines->sl_cur, sizeof (char *), - linesort); - for (i = 0; i < whatis_lines->sl_cur; i++) { - char *line = whatis_lines->sl_str[i]; - if (i > 0 && strcmp(line, prev) == 0) - continue; - prev = line; - (void) fputs(line, output); - (void) putc('\n', output); - } - (void) fclose(output); - sl_free(whatis_lines, 1); - (void) rename(tempfile, name); - (void) unlink(tempfile); -} - -static FILE * -open_whatis(char *mandir) -{ - char filename[MAXPATHLEN]; - - (void) snprintf(filename, MAXPATHLEN, "%s/%s", mandir, WHATIS); - return (open_output(filename)); -} - -static void -finish_whatis(FILE *output, char *mandir) -{ - char filename[MAXPATHLEN]; - - (void) snprintf(filename, MAXPATHLEN, "%s/%s", mandir, WHATIS); - finish_output(output, filename); -} - -/* - * Remove trailing spaces from a string, returning a pointer to just - * beyond the new last character. - */ -static char * -trim_rhs(char *str) -{ - char *rhs; - - rhs = &str[strlen(str)]; - while (--rhs > str && isspace(*rhs)) - ; - *++rhs = '\0'; - return (rhs); -} - -/* - * Return a pointer to the next non-space character in the string. - */ -static char * -skip_spaces(char *s) -{ - - while (*s != '\0' && isspace(*s)) - s++; - - return (s); -} - -/* - * Return whether the line is of one of the forms: - * .Sh NAME - * .Sh "NAME" - * etc. - * assuming that section_start is ".Sh". - */ -static int -name_section_line(char *line, const char *section_start) -{ - char *rhs; - - if (strncmp(line, section_start, 3) != 0) - return (0); - line = skip_spaces(line + 3); - rhs = trim_rhs(line); - if (*line == '"') { - line++; - if (*--rhs == '"') - *rhs = '\0'; - } - if (strcmp(line, "NAME") == 0) - return (1); - - return (0); -} - -/* - * Copy characters while removing the most common nroff/troff markup: - * \(em, \(mi, \s[+-N], \& - * \fF, \f(fo, \f[font] - * \*s, \*(st, \*[stringvar] - */ -static char * -de_nroff_copy(char *from, char *to, int fromlen) -{ - char *from_end = &from[fromlen]; - - while (from < from_end) { - switch (*from) { - case '\\': - switch (*++from) { - case '(': - if (strncmp(&from[1], "em", 2) == 0 || - strncmp(&from[1], "mi", 2) == 0) { - from += 3; - continue; - } - break; - case 's': - if (*++from == '-') - from++; - while (isdigit(*from)) - from++; - continue; - case 'f': - case '*': - if (*++from == '(') { - from += 3; - } else if (*from == '[') { - while (*++from != ']' && - from < from_end) - ; - from++; - } else { - from++; - } - continue; - case '&': - from++; - continue; - } - break; - } - *to++ = *from++; - } - return (to); -} - -/* - * Append a string with the nroff formatting removed. - */ -static void -add_nroff(char *text) -{ - - sbuf_append_edited(whatis_proto, text, de_nroff_copy); -} - -/* - * Appends "name(suffix), " to whatis_final - */ -static void -add_whatis_name(char *name, char *suffix) -{ - - if (*name != '\0') { - sbuf_append_str(whatis_final, name); - sbuf_append(whatis_final, "(", 1); - sbuf_append_str(whatis_final, suffix); - sbuf_append(whatis_final, "), ", 3); - } -} - -/* - * Processes an old-style man(7) line. This ignores commands with only - * a single number argument. - */ -static void -process_man_line(char *line) -{ - char *p; - - if (*line == '.') { - while (isalpha(*++line)) - ; - p = line = skip_spaces(line); - while (*p != '\0') { - if (!isdigit(*p)) - break; - p++; - } - if (*p == '\0') - return; - } else - line = skip_spaces(line); - if (*line != '\0') { - add_nroff(line); - sbuf_append(whatis_proto, " ", 1); - } -} - -/* - * Processes a new-style mdoc(7) line. - */ -static void -process_mdoc_line(char *line) -{ - int xref; - int arg = 0; - char *line_end = &line[strlen(line)]; - int orig_length = sbuf_length(whatis_proto); - char *next; - - if (*line == '\0') - return; - if (line[0] != '.' || !isupper(line[1]) || !islower(line[2])) { - add_nroff(skip_spaces(line)); - sbuf_append(whatis_proto, " ", 1); - return; - } - xref = strncmp(line, ".Xr", 3) == 0; - line += 3; - while ((line = skip_spaces(line)) < line_end) { - if (*line == '"') { - next = ++line; - for (;;) { - next = strchr(next, '"'); - if (next == NULL) - break; - (void) memmove(next, next + 1, strlen(next)); - line_end--; - if (*next != '"') - break; - next++; - } - } else { - next = strpbrk(line, " \t"); - } - if (next != NULL) - *next++ = '\0'; - else - next = line_end; - if (isupper(*line) && islower(line[1]) && line[2] == '\0') { - if (strcmp(line, "Ns") == 0) { - arg = 0; - line = next; - continue; - } - if (strstr(line, MDOC_COMMANDS) != NULL) { - line = next; - continue; - } - } - if (arg > 0 && strchr(",.:;?!)]", *line) == 0) { - if (xref) { - sbuf_append(whatis_proto, "(", 1); - add_nroff(line); - sbuf_append(whatis_proto, ")", 1); - xref = 0; - } else { - sbuf_append(whatis_proto, " ", 1); - } - } - add_nroff(line); - arg++; - line = next; - } - if (sbuf_length(whatis_proto) > orig_length) - sbuf_append(whatis_proto, " ", 1); -} - -/* - * Collect a list of comma-separated names from the text. - */ -static void -collect_names(stringlist *names, char *text) -{ - char *arg; - - for (;;) { - arg = text; - text = strchr(text, ','); - if (text != NULL) - *text++ = '\0'; - (void) sl_add(names, arg); - if (text == NULL) - return; - if (*text == ' ') - text++; - } -} - -enum { STATE_UNKNOWN, STATE_MANSTYLE, STATE_MDOCNAME, STATE_MDOCDESC }; - -/* - * Process a man page source into a single whatis line and add it - * to whatis_lines. - */ -static void -process_page(struct page_info *page, char *section_dir) -{ - FILE *fp; - stringlist *names; - char *descr; - int state = STATE_UNKNOWN; - size_t i; - char *line = NULL; - size_t linecap = 0; - - sbuf_clear(whatis_proto); - if ((fp = fopen(page->filename, "r")) == NULL) { - warn("%s", page->filename); - return; - } - while (getline(&line, &linecap, fp) > 0) { - /* Skip comments */ - if (strncmp(line, ".\\\"", 3) == 0) - continue; - switch (state) { - /* Haven't reached the NAME section yet */ - case STATE_UNKNOWN: - if (name_section_line(line, ".SH")) - state = STATE_MANSTYLE; - else if (name_section_line(line, ".Sh")) - state = STATE_MDOCNAME; - continue; - /* Inside an old-style .SH NAME section */ - case STATE_MANSTYLE: - if (strncmp(line, ".SH", 3) == 0 || - strncmp(line, ".SS", 3) == 0) - break; - (void) trim_rhs(line); - if (strcmp(line, ".") == 0) - continue; - if (strncmp(line, ".IX", 3) == 0) { - line += 3; - line = skip_spaces(line); - } - process_man_line(line); - continue; - /* Inside a new-style .Sh NAME section (the .Nm part) */ - case STATE_MDOCNAME: - (void) trim_rhs(line); - if (strncmp(line, ".Nm", 3) == 0) { - process_mdoc_line(line); - continue; - } else { - if (strcmp(line, ".") == 0) - continue; - sbuf_append(whatis_proto, "- ", 2); - state = STATE_MDOCDESC; - } - /* FALLTHROUGH */ - /* Inside a new-style .Sh NAME section (after the .Nm-s) */ - case STATE_MDOCDESC: - if (strncmp(line, ".Sh", 3) == 0) - break; - (void) trim_rhs(line); - if (strcmp(line, ".") == 0) - continue; - process_mdoc_line(line); - continue; - } - break; - } - (void) fclose(fp); - sbuf_strip(whatis_proto, " \t.-"); - line = sbuf_content(whatis_proto); - /* - * Line now contains the appropriate data, but without the - * proper indentation or the section appended to each name. - */ - descr = strstr(line, " - "); - if (descr == NULL) { - descr = strchr(line, ' '); - if (descr == NULL) - return; - *descr++ = '\0'; - } else { - *descr = '\0'; - descr += 3; - } - names = sl_init(); - collect_names(names, line); - sbuf_clear(whatis_final); - if (!sl_find(names, page->name) && - no_page_exists(section_dir, names, page->suffix)) { - /* - * Add the page name since that's the only - * thing that man(1) will find. - */ - add_whatis_name(page->name, page->suffix); - } - for (i = 0; i < names->sl_cur; i++) - add_whatis_name(names->sl_str[i], page->suffix); - sl_free(names, 0); - /* Remove last ", " */ - sbuf_retract(whatis_final, 2); - while (sbuf_length(whatis_final) < INDENT) - sbuf_append(whatis_final, " ", 1); - sbuf_append(whatis_final, " - ", 3); - sbuf_append_str(whatis_final, skip_spaces(descr)); - (void) sl_add(whatis_lines, strdup(sbuf_content(whatis_final))); -} - -/* - * Sort pages first by inode number, then by name. - */ -static int -pagesort(const void *a, const void *b) -{ - const struct page_info *p1 = *(struct page_info * const *) a; - const struct page_info *p2 = *(struct page_info * const *) b; - - if (p1->inode == p2->inode) - return (strcmp(p1->name, p2->name)); - - return (p1->inode - p2->inode); -} - -/* - * Process a single man section. - */ -static void -process_section(char *section_dir) -{ - struct dirent **entries; - int nentries; - struct page_info **pages; - int npages = 0; - int i; - ino_t prev_inode = 0; - - /* Scan the man section directory for pages */ - nentries = scandir(section_dir, &entries, NULL, alphasort); - - /* Collect information about man pages */ - pages = (struct page_info **)calloc(nentries, - sizeof (struct page_info *)); - for (i = 0; i < nentries; i++) { - struct page_info *info = new_page_info(section_dir, entries[i]); - if (info != NULL) - pages[npages++] = info; - free(entries[i]); - } - free(entries); - qsort(pages, npages, sizeof (struct page_info *), pagesort); - - /* Process each unique page */ - for (i = 0; i < npages; i++) { - struct page_info *page = pages[i]; - if (page->inode != prev_inode) { - prev_inode = page->inode; - process_page(page, section_dir); - } - free_page_info(page); - } - free(pages); -} - -/* - * Return whether the directory entry is a man page section. - */ -static int -select_sections(const struct dirent *entry) -{ - const char *p = &entry->d_name[3]; - - if (strncmp(entry->d_name, "man", 3) != 0) - return (0); - while (*p != '\0') { - if (!isalnum(*p++)) - return (0); - } - return (1); -} - -/* - * Process a single top-level man directory by finding all the - * sub-directories named man* and processing each one in turn. - */ -void -mwpath(char *path) -{ - FILE *fp = NULL; - struct dirent **entries; - int nsections; - int i; - - (void) signal(SIGINT, trap_signal); - (void) signal(SIGHUP, trap_signal); - (void) signal(SIGQUIT, trap_signal); - (void) signal(SIGTERM, trap_signal); - - whatis_proto = new_sbuf(); - whatis_final = new_sbuf(); - - nsections = scandir(path, &entries, select_sections, alphasort); - if ((fp = open_whatis(path)) == NULL) - return; - for (i = 0; i < nsections; i++) { - char section_dir[MAXPATHLEN]; - - (void) snprintf(section_dir, MAXPATHLEN, "%s/%s", - path, entries[i]->d_name); - process_section(section_dir); - free(entries[i]); - } - free(entries); - finish_whatis(fp, path); -} diff --git a/usr/src/cmd/man/man.c b/usr/src/cmd/man/man.c deleted file mode 100644 index 08ec0f02f3..0000000000 --- a/usr/src/cmd/man/man.c +++ /dev/null @@ -1,1619 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ - -/* - * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2012, Josef 'Jeff' Sipek . All rights reserved. - * Copyright 2014 Garrett D'Amore - * Copyright 2016 Nexenta Systems, Inc. - */ - -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T. */ -/* All rights reserved. */ - -/* - * University Copyright- Copyright (c) 1982, 1986, 1988 - * The Regents of the University of California - * All Rights Reserved - * - * University Acknowledgment- Portions of this document are derived from - * software developed by the University of California, Berkeley, and its - * contributors. - */ - -/* - * Find and display reference manual pages. This version includes makewhatis - * functionality as well. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "man.h" - - -/* Mapping of old directories to new directories */ -static const struct map_entry { - char *old_name; - char *new_name; -} map[] = { - { "3b", "3ucb" }, - { "3e", "3elf" }, - { "3g", "3gen" }, - { "3k", "3kstat" }, - { "3n", "3socket" }, - { "3r", "3rt" }, - { "3s", "3c" }, - { "3t", "3thr" }, - { "3x", "3curses" }, - { "3xc", "3xcurses" }, - { "3xn", "3xnet" }, - { NULL, NULL } -}; - -struct suffix { - char *ds; - char *fs; -}; - -/* - * Flags that control behavior of build_manpath() - * - * BMP_ISPATH pathv is a vector constructed from PATH. - * Perform appropriate path translations for - * manpath. - * BMP_APPEND_DEFMANDIR Add DEFMANDIR to the end if it hasn't - * already appeared earlier. - * BMP_FALLBACK_DEFMANDIR Append /usr/share/man only if no other - * manpath (including derived from PATH) - * elements are valid. - */ -#define BMP_ISPATH 1 -#define BMP_APPEND_DEFMANDIR 2 -#define BMP_FALLBACK_DEFMANDIR 4 - -/* - * When doing equality comparisons of directories, device and inode - * comparisons are done. The secnode and dupnode structures are used - * to form a list of lists for this processing. - */ -struct secnode { - char *secp; - struct secnode *next; -}; -struct dupnode { - dev_t dev; /* from struct stat st_dev */ - ino_t ino; /* from struct stat st_ino */ - struct secnode *secl; /* sections already considered */ - struct dupnode *next; -}; - -/* - * Map directories that may appear in PATH to the corresponding - * man directory. - */ -static struct pathmap { - char *bindir; - char *mandir; - dev_t dev; - ino_t ino; -} bintoman[] = { - { "/sbin", "/usr/share/man,1m", 0, 0 }, - { "/usr/sbin", "/usr/share/man,1m", 0, 0 }, - { "/usr/ucb", "/usr/share/man,1b", 0, 0 }, - { "/usr/bin", "/usr/share/man,1,1m,1s,1t,1c", 0, 0 }, - { "/usr/xpg4/bin", "/usr/share/man,1", 0, 0 }, - { "/usr/xpg6/bin", "/usr/share/man,1", 0, 0 }, - { NULL, NULL, 0, 0 } -}; - -struct man_node { - char *path; /* mandir path */ - char **secv; /* submandir suffices */ - int defsrch; /* hint for man -p */ - int frompath; /* hint for man -d */ - struct man_node *next; -}; - -static int all = 0; -static int apropos = 0; -static int debug = 0; -static int found = 0; -static int list = 0; -static int makewhatis = 0; -static int printmp = 0; -static int sargs = 0; -static int psoutput = 0; -static int lintout = 0; -static int whatis = 0; -static int makewhatishere = 0; - -static char *mansec; -static char *pager = NULL; - -static char *addlocale(char *); -static struct man_node *build_manpath(char **, int); -static void do_makewhatis(struct man_node *); -static char *check_config(char *); -static int cmp(const void *, const void *); -static int dupcheck(struct man_node *, struct dupnode **); -static int format(char *, char *, char *, char *); -static void free_dupnode(struct dupnode *); -static void free_manp(struct man_node *manp); -static void freev(char **); -static void fullpaths(struct man_node **); -static void get_all_sect(struct man_node *); -static int getdirs(char *, char ***, int); -static void getpath(struct man_node *, char **); -static void getsect(struct man_node *, char **); -static void init_bintoman(void); -static void lower(char *); -static void mandir(char **, char *, char *, int); -static int manual(struct man_node *, char *); -static char *map_section(char *, char *); -static char *path_to_manpath(char *); -static void print_manpath(struct man_node *); -static void search_whatis(char *, char *); -static int searchdir(char *, char *, char *); -static void sortdir(DIR *, char ***); -static char **split(char *, char); -static void usage_man(void); -static void usage_whatapro(void); -static void usage_catman(void); -static void usage_makewhatis(void); -static void whatapro(struct man_node *, char *); - -static char language[MAXPATHLEN]; /* LC_MESSAGES */ -static char localedir[MAXPATHLEN]; /* locale specific path component */ - -static char *newsection = NULL; - -static int manwidth = 0; - -extern const char *__progname; - -int -main(int argc, char **argv) -{ - int c, i; - char **pathv; - char *manpath = NULL; - static struct man_node *mandirs = NULL; - int bmp_flags = 0; - int ret = 0; - char *opts; - char *mwstr; - int catman = 0; - - (void) setlocale(LC_ALL, ""); - (void) strcpy(language, setlocale(LC_MESSAGES, (char *)NULL)); - if (strcmp("C", language) != 0) - (void) strlcpy(localedir, language, MAXPATHLEN); - -#if !defined(TEXT_DOMAIN) -#define TEXT_DOMAIN "SYS_TEST" -#endif - (void) textdomain(TEXT_DOMAIN); - - if (strcmp(__progname, "apropos") == 0) { - apropos++; - opts = "M:ds:"; - } else if (strcmp(__progname, "whatis") == 0) { - apropos++; - whatis++; - opts = "M:ds:"; - } else if (strcmp(__progname, "catman") == 0) { - catman++; - makewhatis++; - opts = "P:M:w"; - } else if (strcmp(__progname, "makewhatis") == 0) { - makewhatis++; - makewhatishere++; - manpath = "."; - opts = ""; - } else { - opts = "FM:P:T:adfklprs:tw"; - if (argc > 1 && strcmp(argv[1], "-") == 0) { - pager = "cat"; - optind++; - } - } - - opterr = 0; - while ((c = getopt(argc, argv, opts)) != -1) { - switch (c) { - case 'M': /* Respecify path for man pages */ - manpath = optarg; - break; - case 'a': - all++; - break; - case 'd': - debug++; - break; - case 'f': - whatis++; - /*FALLTHROUGH*/ - case 'k': - apropos++; - break; - case 'l': - list++; - all++; - break; - case 'p': - printmp++; - break; - case 's': - mansec = optarg; - sargs++; - break; - case 'r': - lintout++; - break; - case 't': - psoutput++; - break; - case 'T': - case 'P': - case 'F': - /* legacy options, compatibility only and ignored */ - break; - case 'w': - makewhatis++; - break; - case '?': - default: - if (apropos) - usage_whatapro(); - else if (catman) - usage_catman(); - else if (makewhatishere) - usage_makewhatis(); - else - usage_man(); - } - } - argc -= optind; - argv += optind; - - if (argc == 0) { - if (apropos) { - (void) fprintf(stderr, gettext("%s what?\n"), - __progname); - exit(1); - } else if (!printmp && !makewhatis) { - (void) fprintf(stderr, - gettext("What manual page do you want?\n")); - exit(1); - } - } - - init_bintoman(); - if (manpath == NULL && (manpath = getenv("MANPATH")) == NULL) { - if ((manpath = getenv("PATH")) != NULL) - bmp_flags = BMP_ISPATH | BMP_APPEND_DEFMANDIR; - else - manpath = DEFMANDIR; - } - pathv = split(manpath, ':'); - mandirs = build_manpath(pathv, bmp_flags); - freev(pathv); - fullpaths(&mandirs); - - if (makewhatis) { - do_makewhatis(mandirs); - exit(0); - } - - if (printmp) { - print_manpath(mandirs); - exit(0); - } - - /* Collect environment information */ - if (isatty(STDOUT_FILENO) && (mwstr = getenv("MANWIDTH")) != NULL && - *mwstr != '\0') { - if (strcasecmp(mwstr, "tty") == 0) { - struct winsize ws; - - if (ioctl(0, TIOCGWINSZ, &ws) != 0) - warn("TIOCGWINSZ"); - else - manwidth = ws.ws_col; - } else { - manwidth = (int)strtol(mwstr, (char **)NULL, 10); - if (manwidth < 0) - manwidth = 0; - } - } - if (manwidth != 0) { - DPRINTF("-- Using non-standard page width: %d\n", manwidth); - } - - if (pager == NULL) { - if ((pager = getenv("PAGER")) == NULL || *pager == '\0') - pager = PAGER; - } - DPRINTF("-- Using pager: %s\n", pager); - - for (i = 0; i < argc; i++) { - char *cmd; - static struct man_node *mp; - char *pv[2]; - - /* - * If full path to command specified, customize - * the manpath accordingly. - */ - if ((cmd = strrchr(argv[i], '/')) != NULL) { - *cmd = '\0'; - if ((pv[0] = strdup(argv[i])) == NULL) - err(1, "strdup"); - pv[1] = NULL; - *cmd = '/'; - mp = build_manpath(pv, - BMP_ISPATH | BMP_FALLBACK_DEFMANDIR); - } else { - mp = mandirs; - } - - if (apropos) - whatapro(mp, argv[i]); - else - ret += manual(mp, argv[i]); - - if (mp != NULL && mp != mandirs) { - free(pv[0]); - free_manp(mp); - } - } - - return (ret == 0 ? 0 : 1); -} - -/* - * This routine builds the manpage structure from MANPATH or PATH, - * depending on flags. See BMP_* definitions above for valid - * flags. - */ -static struct man_node * -build_manpath(char **pathv, int flags) -{ - struct man_node *manpage = NULL; - struct man_node *currp = NULL; - struct man_node *lastp = NULL; - char **p; - char **q; - char *mand = NULL; - char *mandir = DEFMANDIR; - int s; - struct dupnode *didup = NULL; - struct stat sb; - - s = sizeof (struct man_node); - for (p = pathv; *p != NULL; ) { - if (flags & BMP_ISPATH) { - if ((mand = path_to_manpath(*p)) == NULL) - goto next; - free(*p); - *p = mand; - } - q = split(*p, ','); - if (stat(q[0], &sb) != 0 || (sb.st_mode & S_IFDIR) == 0) { - freev(q); - goto next; - } - - if (access(q[0], R_OK | X_OK) == 0) { - /* - * Some element exists. Do not append DEFMANDIR as a - * fallback. - */ - flags &= ~BMP_FALLBACK_DEFMANDIR; - - if ((currp = (struct man_node *)calloc(1, s)) == NULL) - err(1, "calloc"); - - currp->frompath = (flags & BMP_ISPATH); - - if (manpage == NULL) - lastp = manpage = currp; - - getpath(currp, p); - getsect(currp, p); - - /* - * If there are no new elements in this path, - * do not add it to the manpage list. - */ - if (dupcheck(currp, &didup) != 0) { - freev(currp->secv); - free(currp); - } else { - currp->next = NULL; - if (currp != manpage) - lastp->next = currp; - lastp = currp; - } - } - freev(q); -next: - /* - * Special handling of appending DEFMANDIR. After all pathv - * elements have been processed, append DEFMANDIR if needed. - */ - if (p == &mandir) - break; - p++; - if (*p != NULL) - continue; - if (flags & (BMP_APPEND_DEFMANDIR | BMP_FALLBACK_DEFMANDIR)) { - p = &mandir; - flags &= ~BMP_ISPATH; - } - } - - free_dupnode(didup); - - return (manpage); -} - -/* - * Store the mandir path into the manp structure. - */ -static void -getpath(struct man_node *manp, char **pv) -{ - char *s = *pv; - int i = 0; - - while (*s != '\0' && *s != ',') - i++, s++; - - if ((manp->path = (char *)malloc(i + 1)) == NULL) - err(1, "malloc"); - (void) strlcpy(manp->path, *pv, i + 1); -} - -/* - * Store the mandir's corresponding sections (submandir - * directories) into the manp structure. - */ -static void -getsect(struct man_node *manp, char **pv) -{ - char *sections; - char **sectp; - - /* Just store all sections when doing makewhatis or apropos/whatis */ - if (makewhatis || apropos) { - manp->defsrch = 1; - DPRINTF("-- Adding %s\n", manp->path); - manp->secv = NULL; - get_all_sect(manp); - } else if (sargs) { - DPRINTF("-- Adding %s: sections=%s\n", manp->path, mansec); - manp->secv = split(mansec, ','); - for (sectp = manp->secv; *sectp; sectp++) - lower(*sectp); - } else if ((sections = strchr(*pv, ',')) != NULL) { - sections++; - DPRINTF("-- Adding %s: sections=%s\n", manp->path, sections); - manp->secv = split(sections, ','); - for (sectp = manp->secv; *sectp; sectp++) - lower(*sectp); - if (*manp->secv == NULL) - get_all_sect(manp); - } else if ((sections = check_config(*pv)) != NULL) { - manp->defsrch = 1; - DPRINTF("-- Adding %s: sections=%s (from %s)\n", manp->path, - sections, CONFIG); - manp->secv = split(sections, ','); - for (sectp = manp->secv; *sectp; sectp++) - lower(*sectp); - if (*manp->secv == NULL) - get_all_sect(manp); - } else { - manp->defsrch = 1; - DPRINTF("-- Adding %s: default search order\n", manp->path); - manp->secv = NULL; - get_all_sect(manp); - } -} - -/* - * Get suffices of all sub-mandir directories in a mandir. - */ -static void -get_all_sect(struct man_node *manp) -{ - DIR *dp; - char **dirv; - char **dv; - char **p; - char *prev = NULL; - char *tmp = NULL; - int maxentries = MAXTOKENS; - int entries = 0; - - if ((dp = opendir(manp->path)) == 0) - return; - - sortdir(dp, &dirv); - - (void) closedir(dp); - - if (manp->secv == NULL) { - if ((manp->secv = malloc(maxentries * sizeof (char *))) == NULL) - err(1, "malloc"); - } - - for (dv = dirv, p = manp->secv; *dv; dv++) { - if (strcmp(*dv, CONFIG) == 0) { - free(*dv); - continue; - } - - free(tmp); - if ((tmp = strdup(*dv + 3)) == NULL) - err(1, "strdup"); - - if (prev != NULL && strcmp(prev, tmp) == 0) { - free(*dv); - continue; - } - - free(prev); - if ((prev = strdup(*dv + 3)) == NULL) - err(1, "strdup"); - - if ((*p = strdup(*dv + 3)) == NULL) - err(1, "strdup"); - - p++; entries++; - - if (entries == maxentries) { - maxentries += MAXTOKENS; - if ((manp->secv = realloc(manp->secv, - sizeof (char *) * maxentries)) == NULL) - err(1, "realloc"); - p = manp->secv + entries; - } - free(*dv); - } - free(tmp); - free(prev); - *p = NULL; - free(dirv); -} - -/* - * Build whatis databases. - */ -static void -do_makewhatis(struct man_node *manp) -{ - struct man_node *p; - char *ldir; - - for (p = manp; p != NULL; p = p->next) { - ldir = addlocale(p->path); - if (*localedir != '\0' && getdirs(ldir, NULL, 0) > 0) - mwpath(ldir); - free(ldir); - mwpath(p->path); - } -} - -/* - * Count mandirs under the given manpath - */ -static int -getdirs(char *path, char ***dirv, int flag) -{ - DIR *dp; - struct dirent *d; - int n = 0; - int maxentries = MAXDIRS; - char **dv = NULL; - - if ((dp = opendir(path)) == NULL) - return (0); - - if (flag) { - if ((*dirv = malloc(sizeof (char *) * - maxentries)) == NULL) - err(1, "malloc"); - dv = *dirv; - } - while ((d = readdir(dp))) { - if (strncmp(d->d_name, "man", 3) != 0) - continue; - n++; - - if (flag) { - if ((*dv = strdup(d->d_name + 3)) == NULL) - err(1, "strdup"); - dv++; - if ((dv - *dirv) == maxentries) { - int entries = maxentries; - - maxentries += MAXTOKENS; - if ((*dirv = realloc(*dirv, - sizeof (char *) * maxentries)) == NULL) - err(1, "realloc"); - dv = *dirv + entries; - } - } - } - - (void) closedir(dp); - return (n); -} - - -/* - * Find matching whatis or apropos entries. - */ -static void -whatapro(struct man_node *manp, char *word) -{ - char whatpath[MAXPATHLEN]; - struct man_node *b; - char *ldir; - - for (b = manp; b != NULL; b = b->next) { - if (*localedir != '\0') { - ldir = addlocale(b->path); - if (getdirs(ldir, NULL, 0) != 0) { - (void) snprintf(whatpath, sizeof (whatpath), - "%s/%s", ldir, WHATIS); - search_whatis(whatpath, word); - } - free(ldir); - } - (void) snprintf(whatpath, sizeof (whatpath), "%s/%s", b->path, - WHATIS); - search_whatis(whatpath, word); - } -} - -static void -search_whatis(char *whatpath, char *word) -{ - FILE *fp; - char *line = NULL; - size_t linecap = 0; - char *pkwd; - regex_t preg; - char **ss = NULL; - char s[MAXNAMELEN]; - int i; - - if ((fp = fopen(whatpath, "r")) == NULL) { - perror(whatpath); - return; - } - - DPRINTF("-- Found %s: %s\n", WHATIS, whatpath); - - /* Build keyword regex */ - if (asprintf(&pkwd, "%s%s%s", (whatis) ? "\\<" : "", - word, (whatis) ? "\\>" : "") == -1) - err(1, "asprintf"); - - if (regcomp(&preg, pkwd, REG_BASIC | REG_ICASE | REG_NOSUB) != 0) - err(1, "regcomp"); - - if (sargs) - ss = split(mansec, ','); - - while (getline(&line, &linecap, fp) > 0) { - if (regexec(&preg, line, 0, NULL, 0) == 0) { - if (sargs) { - /* Section-restricted search */ - for (i = 0; ss[i] != NULL; i++) { - (void) snprintf(s, sizeof (s), "(%s)", - ss[i]); - if (strstr(line, s) != NULL) { - (void) printf("%s", line); - break; - } - } - } else { - (void) printf("%s", line); - } - } - } - - if (ss != NULL) - freev(ss); - free(pkwd); - (void) fclose(fp); -} - - -/* - * Split a string by specified separator. - */ -static char ** -split(char *s1, char sep) -{ - char **tokv, **vp; - char *mp = s1, *tp; - int maxentries = MAXTOKENS; - int entries = 0; - - if ((tokv = vp = malloc(maxentries * sizeof (char *))) == NULL) - err(1, "malloc"); - - for (; mp && *mp; mp = tp) { - tp = strchr(mp, sep); - if (mp == tp) { - tp++; - continue; - } - if (tp) { - size_t len; - - len = tp - mp; - if ((*vp = (char *)malloc(sizeof (char) * - len + 1)) == NULL) - err(1, "malloc"); - (void) strncpy(*vp, mp, len); - *(*vp + len) = '\0'; - tp++; - vp++; - } else { - if ((*vp = strdup(mp)) == NULL) - err(1, "strdup"); - vp++; - } - entries++; - if (entries == maxentries) { - maxentries += MAXTOKENS; - if ((tokv = realloc(tokv, - maxentries * sizeof (char *))) == NULL) - err(1, "realloc"); - vp = tokv + entries; - } - } - *vp = 0; - - return (tokv); -} - -/* - * Free a vector allocated by split() - */ -static void -freev(char **v) -{ - int i; - if (v != NULL) { - for (i = 0; v[i] != NULL; i++) { - free(v[i]); - } - free(v); - } -} - -/* - * Convert paths to full paths if necessary - */ -static void -fullpaths(struct man_node **manp_head) -{ - char *cwd = NULL; - char *p; - int cwd_gotten = 0; - struct man_node *manp = *manp_head; - struct man_node *b; - struct man_node *prev = NULL; - - for (b = manp; b != NULL; b = b->next) { - if (*(b->path) == '/') { - prev = b; - continue; - } - - if (!cwd_gotten) { - cwd = getcwd(NULL, MAXPATHLEN); - cwd_gotten = 1; - } - - if (cwd) { - /* Relative manpath with cwd: make absolute */ - if (asprintf(&p, "%s/%s", cwd, b->path) == -1) - err(1, "asprintf"); - free(b->path); - b->path = p; - } else { - /* Relative manpath but no cwd: omit path entry */ - if (prev) - prev->next = b->next; - else - *manp_head = b->next; - - free_manp(b); - } - } - free(cwd); -} - -/* - * Free a man_node structure and its contents - */ -static void -free_manp(struct man_node *manp) -{ - char **p; - - free(manp->path); - p = manp->secv; - while ((p != NULL) && (*p != NULL)) { - free(*p); - p++; - } - free(manp->secv); - free(manp); -} - - -/* - * Map (in place) to lower case. - */ -static void -lower(char *s) -{ - - if (s == 0) - return; - while (*s) { - if (isupper(*s)) - *s = tolower(*s); - s++; - } -} - - -/* - * Compare function for qsort(). - * Sort first by section, then by prefix. - */ -static int -cmp(const void *arg1, const void *arg2) -{ - int n; - char **p1 = (char **)arg1; - char **p2 = (char **)arg2; - - /* By section */ - if ((n = strcmp(*p1 + 3, *p2 + 3)) != 0) - return (n); - - /* By prefix reversed */ - return (strncmp(*p2, *p1, 3)); -} - - -/* - * Find a manpage. - */ -static int -manual(struct man_node *manp, char *name) -{ - struct man_node *p; - struct man_node *local; - int ndirs = 0; - char *ldir; - char *ldirs[2]; - char *fullname = name; - char *slash; - - if ((slash = strrchr(name, '/')) != NULL) - name = slash + 1; - - /* For each path in MANPATH */ - found = 0; - - for (p = manp; p != NULL; p = p->next) { - DPRINTF("-- Searching mandir: %s\n", p->path); - - if (*localedir != '\0') { - ldir = addlocale(p->path); - ndirs = getdirs(ldir, NULL, 0); - if (ndirs != 0) { - ldirs[0] = ldir; - ldirs[1] = NULL; - local = build_manpath(ldirs, 0); - DPRINTF("-- Locale specific subdir: %s\n", - ldir); - mandir(local->secv, ldir, name, 1); - free_manp(local); - } - free(ldir); - } - - /* - * Locale mandir not valid, man page in locale - * mandir not found, or -a option present - */ - if (ndirs == 0 || !found || all) - mandir(p->secv, p->path, name, 0); - - if (found && !all) - break; - } - - if (!found) { - if (sargs) { - (void) fprintf(stderr, gettext( - "No manual entry for %s in section(s) %s\n"), - fullname, mansec); - } else { - (void) fprintf(stderr, - gettext("No manual entry for %s\n"), fullname); - } - - } - - return (!found); -} - - -/* - * For a specified manual directory, read, store and sort section subdirs. - * For each section specified, find and search matching subdirs. - */ -static void -mandir(char **secv, char *path, char *name, int lspec) -{ - DIR *dp; - char **dirv; - char **dv, **pdv; - int len, dslen; - - if ((dp = opendir(path)) == NULL) - return; - - if (lspec) - DPRINTF("-- Searching mandir: %s\n", path); - - sortdir(dp, &dirv); - - /* Search in the order specified by MANSECTS */ - for (; *secv; secv++) { - len = strlen(*secv); - for (dv = dirv; *dv; dv++) { - dslen = strlen(*dv + 3); - if (dslen > len) - len = dslen; - if (**secv == '\\') { - if (strcmp(*secv + 1, *dv + 3) != 0) - continue; - } else if (strncasecmp(*secv, *dv + 3, len) != 0) { - if (!all && - (newsection = map_section(*secv, path)) - == NULL) { - continue; - } - if (newsection == NULL) - newsection = ""; - if (strncmp(newsection, *dv + 3, len) != 0) { - continue; - } - } - - if (searchdir(path, *dv, name) == 0) - continue; - - if (!all) { - pdv = dirv; - while (*pdv) { - free(*pdv); - pdv++; - } - (void) closedir(dp); - free(dirv); - return; - } - - if (all && **dv == 'm' && *(dv + 1) && - strcmp(*(dv + 1) + 3, *dv + 3) == 0) - dv++; - } - } - pdv = dirv; - while (*pdv != NULL) { - free(*pdv); - pdv++; - } - free(dirv); - (void) closedir(dp); -} - -/* - * Sort directories. - */ -static void -sortdir(DIR *dp, char ***dirv) -{ - struct dirent *d; - char **dv; - int maxentries = MAXDIRS; - int entries = 0; - - if ((dv = *dirv = malloc(sizeof (char *) * - maxentries)) == NULL) - err(1, "malloc"); - dv = *dirv; - - while ((d = readdir(dp))) { - if (strcmp(d->d_name, ".") == 0 || - strcmp(d->d_name, "..") == 0) - continue; - - if (strncmp(d->d_name, "man", 3) == 0 || - strncmp(d->d_name, "cat", 3) == 0) { - if ((*dv = strdup(d->d_name)) == NULL) - err(1, "strdup"); - dv++; - entries++; - if (entries == maxentries) { - maxentries += MAXDIRS; - if ((*dirv = realloc(*dirv, - sizeof (char *) * maxentries)) == NULL) - err(1, "realloc"); - dv = *dirv + entries; - } - } - } - *dv = 0; - - qsort((void *)*dirv, dv - *dirv, sizeof (char *), cmp); - -} - - -/* - * Search a section subdir for a given manpage. - */ -static int -searchdir(char *path, char *dir, char *name) -{ - DIR *sdp; - struct dirent *sd; - char sectpath[MAXPATHLEN]; - char file[MAXNAMLEN]; - char dname[MAXPATHLEN]; - char *last; - int nlen; - - (void) snprintf(sectpath, sizeof (sectpath), "%s/%s", path, dir); - (void) snprintf(file, sizeof (file), "%s.", name); - - if ((sdp = opendir(sectpath)) == NULL) - return (0); - - while ((sd = readdir(sdp))) { - char *pname; - - if ((pname = strdup(sd->d_name)) == NULL) - err(1, "strdup"); - if ((last = strrchr(pname, '.')) != NULL && - (strcmp(last, ".gz") == 0 || strcmp(last, ".bz2") == 0)) - *last = '\0'; - last = strrchr(pname, '.'); - nlen = last - pname; - (void) snprintf(dname, sizeof (dname), "%.*s.", nlen, pname); - if (strcmp(dname, file) == 0 || - strcmp(pname, name) == 0) { - (void) format(path, dir, name, sd->d_name); - (void) closedir(sdp); - free(pname); - return (1); - } - free(pname); - } - (void) closedir(sdp); - - return (0); -} - -/* - * Check the hash table of old directory names to see if there is a - * new directory name. - */ -static char * -map_section(char *section, char *path) -{ - int i; - char fullpath[MAXPATHLEN]; - - if (list) /* -l option fall through */ - return (NULL); - - for (i = 0; map[i].new_name != NULL; i++) { - if (strcmp(section, map[i].old_name) == 0) { - (void) snprintf(fullpath, sizeof (fullpath), - "%s/man%s", path, map[i].new_name); - if (!access(fullpath, R_OK | X_OK)) { - return (map[i].new_name); - } else { - return (NULL); - } - } - } - - return (NULL); -} - -/* - * Format the manpage. - */ -static int -format(char *path, char *dir, char *name, char *pg) -{ - char manpname[MAXPATHLEN], catpname[MAXPATHLEN]; - char cmdbuf[BUFSIZ], tmpbuf[BUFSIZ]; - char *cattool; - struct stat sbman, sbcat; - - found++; - - if (list) { - (void) printf(gettext("%s(%s)\t-M %s\n"), name, dir + 3, path); - return (-1); - } - - (void) snprintf(manpname, sizeof (manpname), "%s/man%s/%s", path, - dir + 3, pg); - (void) snprintf(catpname, sizeof (catpname), "%s/cat%s/%s", path, - dir + 3, pg); - - /* Can't do PS output if manpage doesn't exist */ - if (stat(manpname, &sbman) != 0 && (psoutput|lintout)) - return (-1); - - /* - * If both manpage and catpage do not exist, manpname is - * broken symlink, most likely. - */ - if (stat(catpname, &sbcat) != 0 && stat(manpname, &sbman) != 0) - err(1, "%s", manpname); - - /* Setup cattool */ - if (fnmatch("*.gz", manpname, 0) == 0) - cattool = "gzcat"; - else if (fnmatch("*.bz2", manpname, 0) == 0) - cattool = "bzcat"; - else - cattool = "cat"; - - if (psoutput) { - (void) snprintf(cmdbuf, BUFSIZ, - "cd %s; %s %s | mandoc -Tps | lp -Tpostscript", - path, cattool, manpname); - DPRINTF("-- Using manpage: %s\n", manpname); - goto cmd; - } else if (lintout) { - (void) snprintf(cmdbuf, BUFSIZ, - "cd %s; %s %s | mandoc -Tlint", - path, cattool, manpname); - DPRINTF("-- Linting manpage: %s\n", manpname); - goto cmd; - } - - /* - * Output catpage if: - * - manpage doesn't exist - * - output width is standard and catpage is recent enough - */ - if (stat(manpname, &sbman) != 0 || (manwidth == 0 && - stat(catpname, &sbcat) == 0 && sbcat.st_mtime >= sbman.st_mtime)) { - DPRINTF("-- Using catpage: %s\n", catpname); - (void) snprintf(cmdbuf, BUFSIZ, "%s %s", pager, catpname); - goto cmd; - } - - DPRINTF("-- Using manpage: %s\n", manpname); - if (manwidth > 0) - (void) snprintf(tmpbuf, BUFSIZ, "-Owidth=%d ", manwidth); - (void) snprintf(cmdbuf, BUFSIZ, "cd %s; %s %s | mandoc %s| %s", - path, cattool, manpname, (manwidth > 0) ? tmpbuf : "", pager); - -cmd: - DPRINTF("-- Command: %s\n", cmdbuf); - - if (!debug) - return (system(cmdbuf) == 0); - else - return (0); -} - -/* - * Add to the path. - */ -static char * -addlocale(char *path) -{ - char *tmp; - - if (asprintf(&tmp, "%s/%s", path, localedir) == -1) - err(1, "asprintf"); - - return (tmp); -} - -/* - * Get the order of sections from man.cf. - */ -static char * -check_config(char *path) -{ - FILE *fp; - char *rc = NULL; - char *sect = NULL; - char fname[MAXPATHLEN]; - char *line = NULL; - char *nl; - size_t linecap = 0; - - (void) snprintf(fname, MAXPATHLEN, "%s/%s", path, CONFIG); - - if ((fp = fopen(fname, "r")) == NULL) - return (NULL); - - while (getline(&line, &linecap, fp) > 0) { - if ((rc = strstr(line, "MANSECTS=")) != NULL) - break; - } - - (void) fclose(fp); - - if (rc != NULL) { - if ((nl = strchr(rc, '\n')) != NULL) - *nl = '\0'; - sect = strchr(rc, '=') + 1; - } - - return (sect); -} - -/* - * Initialize the bintoman array with appropriate device and inode info. - */ -static void -init_bintoman(void) -{ - int i; - struct stat sb; - - for (i = 0; bintoman[i].bindir != NULL; i++) { - if (stat(bintoman[i].bindir, &sb) == 0) { - bintoman[i].dev = sb.st_dev; - bintoman[i].ino = sb.st_ino; - } else { - bintoman[i].dev = NODEV; - } - } -} - -/* - * If a duplicate is found, return 1. - * If a duplicate is not found, add it to the dupnode list and return 0. - */ -static int -dupcheck(struct man_node *mnp, struct dupnode **dnp) -{ - struct dupnode *curdnp; - struct secnode *cursnp; - struct stat sb; - int i; - int rv = 1; - int dupfound; - - /* If the path doesn't exist, treat it as a duplicate */ - if (stat(mnp->path, &sb) != 0) - return (1); - - /* If no sections were found in the man dir, treat it as duplicate */ - if (mnp->secv == NULL) - return (1); - - /* - * Find the dupnode structure for the previous time this directory - * was looked at. Device and inode numbers are compared so that - * directories that are reached via different paths (e.g. /usr/man and - * /usr/share/man) are treated as equivalent. - */ - for (curdnp = *dnp; curdnp != NULL; curdnp = curdnp->next) { - if (curdnp->dev == sb.st_dev && curdnp->ino == sb.st_ino) - break; - } - - /* - * First time this directory has been seen. Add a new node to the - * head of the list. Since all entries are guaranteed to be unique - * copy all sections to new node. - */ - if (curdnp == NULL) { - if ((curdnp = calloc(1, sizeof (struct dupnode))) == NULL) - err(1, "calloc"); - for (i = 0; mnp->secv[i] != NULL; i++) { - if ((cursnp = calloc(1, sizeof (struct secnode))) - == NULL) - err(1, "calloc"); - cursnp->next = curdnp->secl; - curdnp->secl = cursnp; - if ((cursnp->secp = strdup(mnp->secv[i])) == NULL) - err(1, "strdup"); - } - curdnp->dev = sb.st_dev; - curdnp->ino = sb.st_ino; - curdnp->next = *dnp; - *dnp = curdnp; - return (0); - } - - /* - * Traverse the section vector in the man_node and the section list - * in dupnode cache to eliminate all duplicates from man_node. - */ - for (i = 0; mnp->secv[i] != NULL; i++) { - dupfound = 0; - for (cursnp = curdnp->secl; cursnp != NULL; - cursnp = cursnp->next) { - if (strcmp(mnp->secv[i], cursnp->secp) == 0) { - dupfound = 1; - break; - } - } - if (dupfound) { - mnp->secv[i][0] = '\0'; - continue; - } - - - /* - * Update curdnp and set return value to indicate that this - * was not all duplicates. - */ - if ((cursnp = calloc(1, sizeof (struct secnode))) == NULL) - err(1, "calloc"); - cursnp->next = curdnp->secl; - curdnp->secl = cursnp; - if ((cursnp->secp = strdup(mnp->secv[i])) == NULL) - err(1, "strdup"); - rv = 0; - } - - return (rv); -} - -/* - * Given a bindir, return corresponding mandir. - */ -static char * -path_to_manpath(char *bindir) -{ - char *mand, *p; - int i; - struct stat sb; - - /* First look for known translations for specific bin paths */ - if (stat(bindir, &sb) != 0) { - return (NULL); - } - for (i = 0; bintoman[i].bindir != NULL; i++) { - if (sb.st_dev == bintoman[i].dev && - sb.st_ino == bintoman[i].ino) { - if ((mand = strdup(bintoman[i].mandir)) == NULL) - err(1, "strdup"); - if ((p = strchr(mand, ',')) != NULL) - *p = '\0'; - if (stat(mand, &sb) != 0) { - free(mand); - return (NULL); - } - if (p != NULL) - *p = ','; - return (mand); - } - } - - /* - * No specific translation found. Try `dirname $bindir`/share/man - * and `dirname $bindir`/man - */ - if ((mand = malloc(MAXPATHLEN)) == NULL) - err(1, "malloc"); - if (strlcpy(mand, bindir, MAXPATHLEN) >= MAXPATHLEN) { - free(mand); - return (NULL); - } - - /* - * Advance to end of buffer, strip trailing /'s then remove last - * directory component. - */ - for (p = mand; *p != '\0'; p++) - ; - for (; p > mand && *p == '/'; p--) - ; - for (; p > mand && *p != '/'; p--) - ; - if (p == mand && *p == '.') { - if (realpath("..", mand) == NULL) { - free(mand); - return (NULL); - } - for (; *p != '\0'; p++) - ; - } else { - *p = '\0'; - } - - if (strlcat(mand, "/share/man", MAXPATHLEN) >= MAXPATHLEN) { - free(mand); - return (NULL); - } - - if ((stat(mand, &sb) == 0) && S_ISDIR(sb.st_mode)) { - return (mand); - } - - /* - * Strip the /share/man off and try /man - */ - *p = '\0'; - if (strlcat(mand, "/man", MAXPATHLEN) >= MAXPATHLEN) { - free(mand); - return (NULL); - } - if ((stat(mand, &sb) == 0) && S_ISDIR(sb.st_mode)) { - return (mand); - } - - /* - * No man or share/man directory found - */ - free(mand); - return (NULL); -} - -/* - * Free a linked list of dupnode structs. - */ -void -free_dupnode(struct dupnode *dnp) -{ - struct dupnode *dnp2; - struct secnode *snp; - - while (dnp != NULL) { - dnp2 = dnp; - dnp = dnp->next; - while (dnp2->secl != NULL) { - snp = dnp2->secl; - dnp2->secl = dnp2->secl->next; - free(snp->secp); - free(snp); - } - free(dnp2); - } -} - -/* - * Print manp linked list to stdout. - */ -void -print_manpath(struct man_node *manp) -{ - char colon[2] = "\0\0"; - char **secp; - - for (; manp != NULL; manp = manp->next) { - (void) printf("%s%s", colon, manp->path); - colon[0] = ':'; - - /* - * If man.cf or a directory scan was used to create section - * list, do not print section list again. If the output of - * man -p is used to set MANPATH, subsequent runs of man - * will re-read man.cf and/or scan man directories as - * required. - */ - if (manp->defsrch != 0) - continue; - - for (secp = manp->secv; *secp != NULL; secp++) { - /* - * Section deduplication may have eliminated some - * sections from the vector. Avoid displaying this - * detail which would appear as ",," in output - */ - if ((*secp)[0] != '\0') - (void) printf(",%s", *secp); - } - } - (void) printf("\n"); -} - -static void -usage_man(void) -{ - - (void) fprintf(stderr, gettext( -"usage: man [-alptw] [-M path] [-s section] name ...\n" -" man [-M path] [-s section] -k keyword ...\n" -" man [-M path] [-s section] -f keyword ...\n")); - - exit(1); -} - -static void -usage_whatapro(void) -{ - - (void) fprintf(stderr, gettext( -"usage: %s [-M path] [-s section] keyword ...\n"), - whatis ? "whatis" : "apropos"); - - exit(1); -} - -static void -usage_catman(void) -{ - (void) fprintf(stderr, gettext( -"usage: catman [-M path] [-w]\n")); - - exit(1); -} - -static void -usage_makewhatis(void) -{ - (void) fprintf(stderr, gettext("usage: makewhatis\n")); - - exit(1); -} diff --git a/usr/src/cmd/man/man.h b/usr/src/cmd/man/man.h deleted file mode 100644 index b4ec3f380a..0000000000 --- a/usr/src/cmd/man/man.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file and its contents are supplied under the terms of the - * Common Development and Distribution License ("CDDL"), version 1.0. - * You may only use this file in accordance with the terms of version - * 1.0 of the CDDL. - * - * A full copy of the text of the CDDL should have accompanied this - * source. A copy of the CDDL is also available via the Internet at - * http://www.illumos.org/license/CDDL. - */ - -/* - * Copyright 2014 Garrett D'Amore - * Copyright 2015 Nexenta Systems, Inc. All rights reserved. - */ - -/* - * Common definitions - */ - -#ifndef _MAN_H_ -#define _MAN_H_ - -#define CONFIG "man.cf" -#define DEFMANDIR "/usr/share/man" -#define INDENT 24 -#define PAGER "less -ins" -#define WHATIS "whatis" - -#define LINE_ALLOC 4096 -#define MAXDIRS 128 -#define MAXTOKENS 64 - -#define DPRINTF if (debug) \ - (void) printf - -void mwpath(char *path); - -#endif /* _MAN_H_ */ diff --git a/usr/src/cmd/man/stringlist.c b/usr/src/cmd/man/stringlist.c deleted file mode 100644 index e9f6035358..0000000000 --- a/usr/src/cmd/man/stringlist.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. - */ - -#include -#include -#include -#include - -#include "stringlist.h" - -#define _SL_CHUNKSIZE 20 - -stringlist * -sl_init(void) -{ - stringlist *sl; - - if ((sl = malloc(sizeof (stringlist))) == NULL) - err(1, "malloc"); - - sl->sl_cur = 0; - sl->sl_max = _SL_CHUNKSIZE; - sl->sl_str = malloc(sl->sl_max * sizeof (char *)); - if (sl->sl_str == NULL) - err(1, "malloc"); - - return (sl); -} - -int -sl_add(stringlist *sl, char *name) -{ - - if (sl->sl_cur == sl->sl_max - 1) { - sl->sl_max += _SL_CHUNKSIZE; - sl->sl_str = realloc(sl->sl_str, sl->sl_max * sizeof (char *)); - if (sl->sl_str == NULL) - return (-1); - } - sl->sl_str[sl->sl_cur++] = name; - - return (0); -} - - -void -sl_free(stringlist *sl, int all) -{ - size_t i; - - if (sl == NULL) - return; - if (sl->sl_str) { - if (all) - for (i = 0; i < sl->sl_cur; i++) - free(sl->sl_str[i]); - free(sl->sl_str); - } - free(sl); -} - - -char * -sl_find(stringlist *sl, char *name) -{ - size_t i; - - for (i = 0; i < sl->sl_cur; i++) - if (strcmp(sl->sl_str[i], name) == 0) - return (sl->sl_str[i]); - - return (NULL); -} diff --git a/usr/src/cmd/man/stringlist.h b/usr/src/cmd/man/stringlist.h deleted file mode 100644 index 2813a102b0..0000000000 --- a/usr/src/cmd/man/stringlist.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1994 Christos Zoulas - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Christos Zoulas. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Copyright 2012 Nexenta Systems, Inc. All rights reserved. - */ - -#ifndef _STRINGLIST_H_ -#define _STRINGLIST_H_ - -#include - -typedef struct _stringlist { - char **sl_str; - size_t sl_max; - size_t sl_cur; -} stringlist; - -stringlist *sl_init(void); -int sl_add(stringlist *, char *); -void sl_free(stringlist *, int); -char *sl_find(stringlist *, char *); - -#endif /* _STRINGLIST_H_ */ diff --git a/usr/src/pkg/manifests/system-man.mf b/usr/src/pkg/manifests/system-man.mf dissimilarity index 85% index 31bccf54db..37b89ffb2b 100644 --- a/usr/src/pkg/manifests/system-man.mf +++ b/usr/src/pkg/manifests/system-man.mf @@ -1,62 +1,24 @@ -# -# This file and its contents are supplied under the terms of the -# Common Development and Distribution License ("CDDL"), version 1.0. -# You may only use this file in accordance with the terms of version -# 1.0 of the CDDL. -# -# A full copy of the text of the CDDL should have accompanied this -# source. A copy of the CDDL is also available via the Internet at -# http://www.illumos.org/license/CDDL. -# - -# -# Copyright 2014 Garrett D'Amore -# Copyright 2015 Nexenta Systems, Inc. All rights reserved. -# - -set name=pkg.fmri value=pkg:/system/man@$(PKGVERS) -set name=pkg.description \ - value="utilities for display and formatting of reference manual pages" -set name=pkg.summary value="Reference Manual Pages Tools" -set name=info.classification \ - value="org.opensolaris.category.2008:System/Text Tools" -set name=variant.arch value=$(ARCH) -dir path=usr/bin -dir path=usr/share -dir path=usr/share/man -dir path=usr/share/man/man1 -dir path=usr/share/man/man1m -dir path=usr/share/man/man5 -file path=usr/bin/man mode=0555 -file path=usr/bin/mandoc mode=0555 -file path=usr/share/man/man1/apropos.1 -file path=usr/share/man/man1/man.1 -file path=usr/share/man/man1/mandoc.1 -file path=usr/share/man/man1m/catman.1m -file path=usr/share/man/man5/eqn.5 -file path=usr/share/man/man5/man.5 -file path=usr/share/man/man5/mandoc_char.5 -file path=usr/share/man/man5/mandoc_roff.5 -file path=usr/share/man/man5/mdoc.5 -file path=usr/share/man/man5/tbl.5 -hardlink path=usr/bin/apropos target=../../usr/bin/man -hardlink path=usr/bin/catman target=../../usr/bin/man -hardlink path=usr/bin/whatis target=../../usr/bin/man -hardlink path=usr/lib/makewhatis target=../../usr/bin/man -license lic_CDDL license=lic_CDDL -license usr/src/cmd/man/THIRDPARTYLICENSE \ - license=usr/src/cmd/man/THIRDPARTYLICENSE -license usr/src/cmd/mandoc/THIRDPARTYLICENSE \ - license=usr/src/cmd/mandoc/THIRDPARTYLICENSE -link path=usr/man target=./share/man -link path=usr/share/man/man1/whatis.1 target=apropos.1 -# arguably we also need lp, for man -t support, but really we don't -# want to make this mandatory, so we don't express the dependency here. -# gzcat/bzcat are used for displaying compressed manpages. However, -# as we don't format such pages this way by default, lets leave the -# dependency out. -#depend fmri=compress/bzip2 type=require -#depend fmri=compress/gzip type=require -# less is the default (per user environment) pager. We really should just -# import this into illumos-gate. -depend fmri=text/less type=require +set name=pkg.fmri value=pkg:/system/man@$(PKGVERS) +set name=pkg.summary value="mandoc toolset" +dir path=usr group=sys +dir path=usr/bin +dir path=usr/share +dir path=usr/share/man +dir path=usr/share/man/man1 +dir path=usr/share/man/man5 +dir path=usr/share/man/man7 +file path=usr/bin/mandoc mode=0555 +file path=usr/share/man/man1/apropos.1 +file path=usr/share/man/man1/man.1 +file path=usr/share/man/man1/mandoc.1 +file path=usr/share/man/man5/man.conf.5 +file path=usr/share/man/man7/eqn.7 +file path=usr/share/man/man7/man.7 +file path=usr/share/man/man7/mandoc_char.7 +file path=usr/share/man/man7/mdoc.7 +file path=usr/share/man/man7/roff.7 +file path=usr/share/man/man7/tbl.7 +hardlink path=usr/bin/apropos target=mandoc +hardlink path=usr/bin/man target=mandoc +hardlink path=usr/bin/whatis target=mandoc +link path=usr/share/man/man1/whatis.1 target=apropos.1 -- 2.11.4.GIT