Merge ^/head r338731 through r338987.

This commit is contained in:
Dimitry Andric 2018-09-27 20:00:07 +00:00
commit ce44d80853
451 changed files with 6076 additions and 3662 deletions

View File

@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20180913:
Reproducible build mode is now on by default, in preparation for
FreeBSD 12.0. This eliminates build metadata such as the user,
host, and time from the kernel (and uname), unless the working tree
corresponds to a modified checkout from a version control system.
The previous behavior can be obtained by setting the /etc/src.conf
knob WITHOUT_REPRODUCIBLE_BUILD.
20180826:
The Yarrow CSPRNG has been removed from the kernel as it has not been
supported by its designers since at least 2003. Fortuna has been the
@ -169,6 +177,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
r334930 changed the interface between the NFS modules, so they all
need to be rebuilt. r335018 did a __FreeBSD_version bump for this.
20180530:
As of r334391 lld is the default amd64 system linker; it is installed
as /usr/bin/ld. Kernel build workarounds (see 20180510 entry) are no
longer necessary.
20180530:
The kernel / userland interface for devinfo changed, so you'll
need a new kernel and userland as a pair for it to work (rebuilding
@ -196,6 +209,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
binutils port/package). lld will soon be default, and this requirement
will go away.
NOTE: As of r334391 lld is the default system linker on amd64, and no
workaround is necessary.
20180508:
The nxge(4) driver has been removed. This driver was for PCI-X 10g
cards made by s2io/Neterion. The company was aquired by Exar and

View File

@ -29,7 +29,7 @@
.\"
.\" from: @(#)make.1 8.4 (Berkeley) 3/19/94
.\"
.Dd June 22, 2017
.Dd September 27, 2018
.Dt MAKE 1
.Os
.Sh NAME
@ -796,7 +796,7 @@ Tells
whether to pass the descriptors of the job token queue
even if the target is not tagged with
.Ic .MAKE
The default is
The default is
.Ql Pa yes
for backwards compatability with
.Fx 9.0
@ -2385,7 +2385,8 @@ Basic use of suffix rules (for files only in the current directory,
not trying to chain transformations together, etc.) is also reasonably
portable.
.Sh SEE ALSO
.Xr mkdep 1
.Xr mkdep 1 ,
.Xr style.Makefile 5
.Sh HISTORY
A
.Nm

View File

@ -78,7 +78,6 @@ Currently, the library automatically detects and reads the following fomats:
* POSIX pax interchange format
* POSIX octet-oriented cpio
* SVR4 ASCII cpio
* POSIX octet-oriented cpio
* Binary cpio (big-endian or little-endian)
* ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
* ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)

View File

@ -2058,6 +2058,12 @@ next_field(const char **p, const char **start,
}
*sep = **p;
/* If the field is only whitespace, bail out now. */
if (**p == '\0') {
*end = *p;
return;
}
/* Trim trailing whitespace to locate end of field. */
*end = *p - 1;
while (**end == ' ' || **end == '\t' || **end == '\n') {

View File

@ -316,7 +316,14 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len)
memcpy(ctx->key, key, key_len);
memset(ctx->nonce, 0, sizeof(ctx->nonce));
ctx->encr_pos = AES_BLOCK_SIZE;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
if (!EVP_CIPHER_CTX_reset(ctx->ctx)) {
EVP_CIPHER_CTX_free(ctx->ctx);
ctx->ctx = NULL;
}
#else
EVP_CIPHER_CTX_init(ctx->ctx);
#endif
return 0;
}

View File

@ -459,6 +459,7 @@ ar_parse_common_header(struct ar *ar, struct archive_entry *entry,
uint64_t n;
/* Copy remaining header */
archive_entry_set_filetype(entry, AE_IFREG);
archive_entry_set_mtime(entry,
(time_t)ar_atol10(h + AR_date_offset, AR_date_size), 0L);
archive_entry_set_uid(entry,

View File

@ -2708,6 +2708,11 @@ slurp_central_directory(struct archive_read *a, struct zip *zip)
return ARCHIVE_FATAL;
zip_entry = calloc(1, sizeof(struct zip_entry));
if (zip_entry == NULL) {
archive_set_error(&a->archive, ENOMEM,
"Can't allocate zip entry");
return ARCHIVE_FATAL;
}
zip_entry->next = zip->zip_entries;
zip_entry->flags |= LA_FROM_CENTRAL_DIRECTORY;
zip->zip_entries = zip_entry;

View File

@ -422,6 +422,7 @@ verify_sparse_file(struct archive *a, const char *path,
assert(sparse->type == END);
assertEqualInt(expected_offset, archive_entry_size(ae));
failure(path);
assertEqualInt(holes_seen, expected_holes);
assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
@ -457,6 +458,7 @@ verify_sparse_file2(struct archive *a, const char *path,
/* Verify the number of holes only, not its offset nor its
* length because those alignments are deeply dependence on
* its filesystem. */
failure(path);
assertEqualInt(blocks, archive_entry_sparse_count(ae));
archive_entry_free(ae);
}

View File

@ -2166,7 +2166,7 @@ void assertVersion(const char *prog, const char *base)
/* Skip arbitrary third-party version numbers. */
while (s > 0 && (*q == ' ' || *q == '-' || *q == '/' || *q == '.' ||
isalnum(*q))) {
isalnum((unsigned char)*q))) {
++q;
--s;
}

View File

@ -1,4 +1,4 @@
$Id: INSTALL,v 1.20 2017/07/28 14:57:56 schwarze Exp $
$Id: INSTALL,v 1.22 2018/07/31 15:34:00 schwarze Exp $
About the portable mandoc distribution
--------------------------------------
@ -18,7 +18,7 @@ tech@ mailing list, too.
Enjoy using the mandoc toolset!
Ingo Schwarze, Karlsruhe, July 2017
Ingo Schwarze, Karlsruhe, August 2018
Installation
@ -54,8 +54,6 @@ generates. If anything looks wrong or different from what you
wish, read the file "configure.local.example", create and edit
a file "configure.local", and re-run "./configure" until the
result seems right to you.
On Solaris 10 and earlier, you may have to run "ksh ./configure"
because the native /bin/sh lacks some POSIX features.
5. Run "make".
Any POSIX-compatible make, in particular both BSD make and GNU make,
@ -83,12 +81,14 @@ apropos(1) will not find the new pages.
10. To set up a man.cgi(8) server, read its manual page.
Note that some man(7) pages may contain low-level roff(7) markup
that mandoc does not yet understand. On some BSD systems using
mandoc, third-party software is vetted on whether it may be formatted
with mandoc. If not, groff(1) is pulled in as a dependency and
used to install a pre-formatted "catpage" instead of directly as
manual page source.
Note that a very small number of man(7) pages contain low-level
roff(7) markup that mandoc does not yet understand. On some BSD
systems using mandoc, third-party software is vetted on whether it
may be formatted with mandoc. If not, groff(1) is pulled in as a
dependency and used to install pre-formatted "catpages" instead of
manual page sources. This mechanism is used much less frequently
than in the past. On OpenBSD, only 25 out of about 10000 ports
still require formatting with groff(1).
Understanding mandoc dependencies

View File

@ -1,17 +1,17 @@
$Id: LICENSE,v 1.17 2017/06/23 15:58:14 schwarze Exp $
$Id: LICENSE,v 1.19 2018/07/31 10:18:15 schwarze Exp $
With the exceptions noted below, all code and documentation
contained in the mandoc toolkit is protected by the Copyright
of the following developers:
Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
Copyright (c) 1999, 2004, 2017 Marc Espie <espie@openbsd.org>
Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger <joerg@netbsd.org>
Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
Copyright (c) 2014 Baptiste Daroussin <bapt@freebsd.org>
Copyright (c) 2016 Ed Maste <emaste@freebsd.org>
Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
Copyright (c) 1999, 2004 Marc Espie <espie@openbsd.org>
Copyright (c) 1998, 2004, 2010 Todd C. Miller <Todd.Miller@courtesan.com>
Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
Copyright (c) 2004 Ted Unangst <tedu@openbsd.org>

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.516 2017/07/20 16:24:53 schwarze Exp $
# $Id: Makefile,v 1.519 2018/07/31 15:34:00 schwarze Exp $
#
# Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
# Copyright (c) 2011, 2013-2017 Ingo Schwarze <schwarze@openbsd.org>
# Copyright (c) 2011, 2013-2018 Ingo Schwarze <schwarze@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@ -15,7 +15,7 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
VERSION = 1.14.3
VERSION = 1.14.4
# === LIST OF FILES ====================================================
@ -30,6 +30,7 @@ TESTSRCS = test-be32toh.c \
test-isblank.c \
test-mkdtemp.c \
test-nanosleep.c \
test-noop.c \
test-ntohl.c \
test-O_DIRECTORY.c \
test-ohash.c \
@ -46,6 +47,7 @@ TESTSRCS = test-be32toh.c \
test-stringlist.c \
test-strlcat.c \
test-strlcpy.c \
test-strndup.c \
test-strptime.c \
test-strsep.c \
test-strtonum.c \
@ -70,6 +72,7 @@ SRCS = att.c \
compat_stringlist.c \
compat_strlcat.c \
compat_strlcpy.c \
compat_strndup.c \
compat_strsep.c \
compat_strtonum.c \
compat_vasprintf.c \
@ -249,6 +252,7 @@ COMPAT_OBJS = compat_err.o \
compat_strcasestr.o \
compat_strlcat.o \
compat_strlcpy.o \
compat_strndup.o \
compat_strsep.o \
compat_strtonum.o \
compat_vasprintf.o
@ -544,12 +548,12 @@ regress-distcheck:
! -path regress/regress.pl \
! -path regress/regress.pl.1
dist: mandoc.sha256
dist: mandoc-$(VERSION).sha256
mandoc.sha256: mandoc.tar.gz
sha256 mandoc.tar.gz > $@
mandoc-$(VERSION).sha256: mandoc-$(VERSION).tar.gz
sha256 mandoc-$(VERSION).tar.gz > $@
mandoc.tar.gz: $(DISTFILES)
mandoc-$(VERSION).tar.gz: $(DISTFILES)
ls regress/*/*/*.mandoc_* && exit 1 || true
mkdir -p .dist/mandoc-$(VERSION)/
$(INSTALL) -m 0644 $(DISTFILES) .dist/mandoc-$(VERSION)

View File

@ -16,6 +16,7 @@ compat_strcasestr.o: compat_strcasestr.c config.h
compat_stringlist.o: compat_stringlist.c config.h compat_stringlist.h
compat_strlcat.o: compat_strlcat.c config.h
compat_strlcpy.o: compat_strlcpy.c config.h
compat_strndup.o: compat_strndup.c config.h
compat_strsep.o: compat_strsep.c config.h
compat_strtonum.o: compat_strtonum.c config.h
compat_vasprintf.o: compat_vasprintf.c config.h
@ -29,7 +30,7 @@ demandoc.o: demandoc.c config.h mandoc.h roff.h man.h mdoc.h
eqn.o: eqn.c config.h mandoc_aux.h mandoc.h roff.h libmandoc.h libroff.h
eqn_html.o: eqn_html.c config.h mandoc.h out.h html.h
eqn_term.o: eqn_term.c config.h mandoc.h out.h term.h
html.o: html.c config.h mandoc_aux.h mandoc.h roff.h out.h html.h manconf.h main.h
html.o: html.c config.h mandoc_aux.h mandoc_ohash.h compat_ohash.h mandoc.h roff.h out.h html.h manconf.h main.h
lib.o: lib.c config.h mandoc.h roff.h mdoc.h libmdoc.h lib.in
main.o: main.c config.h mandoc_aux.h mandoc.h mandoc_xr.h roff.h mdoc.h man.h tag.h main.h manconf.h mansearch.h
man.o: man.c config.h mandoc_aux.h mandoc.h roff.h man.h libmandoc.h roff_int.h libman.h

View File

@ -1,7 +1,84 @@
$Id: NEWS,v 1.26 2017/07/28 14:57:56 schwarze Exp $
$Id: NEWS,v 1.32 2018/08/08 14:47:38 schwarze Exp $
This file lists the most important changes in the mandoc.bsd.lv distribution.
Changes in version 1.14.4, released on August 8, 2018
--- MAJOR NEW FEATURES ---
* In ASCII output, render mathematical symbols and greek letters
as transliterations conveying the characters' meanings rather
than trying to imitate their shape. Consequently, such characters
can now be used in portable manual pages. All the same, please
limit their use to contexts where they really matter, for example
when showing complicated mathematical formulae.
* First steps towards better support for small screens in HTML
output (responsive design): avoid most style= attributes, in
particular all hard-coded indentations and column widths, and
provide a better mandoc.css style sheet with a @media query,
using em units throughout, and avoiding redundancy in selectors.
* Better HTML output with some more fitting HTML elements, eliminating
needless class= attributes, and avoiding various HTML syntax errors
(element nesting, URL-fragment syntax, duplicate id= attributes).
--- MINOR NEW FEATURES ---
* When a man(1) argument contains a slash, imply -l like in man-db.
* Use TIOCGWINSZ to reduce the default -Owidth and -Oindent during
interactive use on terminals narrower than 79 columns.
* Generated PostScript files are now more than 50% smaller.
* Terminal rendering of eqn(7) is improved in several respects.
* Simplified and nicer output from the mdoc(7) .Lk macro, formatting
all links in-line, even long ones.
* roff(7) \n+ and \n- numerical register auto-increment and -decrement
* roff(7) .nr optional third argument (auto-increment step size)
* Autodetect in ./configure whether the compiler can use -W and -static,
allowing to build on Solaris 10 and 11 without any configure.local.
--- RELIABILITY BUGFIXES ---
* Only activate UTF-8 output when the user really selected UTF-8,
not some other multibyte character encoding.
* Prevent excessive .ll arguments from generating infinite output.
* Fix out of bounds accesses to parse buffers that could happen when
using renamed or user defined macros after roff(7) conditionals.
* Avoid an assertion failure in certain .Bl -column lists.
* Avoid a NULL pointer access on deroff() failure after '.SS ""'.
* Fix a segfault that could be triggered by two invalid .Dt macros.
* Fix two syntax errors in generated PDF files.
* Properly state the page size in generated PostScript files.
* Close a memory leak caused by missing gzclose(3).
* Fix misformatting of man(7) documents lacking .SH macros
in PostScript and PDF output.
* And many minor bugfixes.
--- THANKS TO ---
* Marc Espie (OpenBSD) for implementing the size reduction of
PostScript files, one additional patch for code simplification,
and two bug reports.
* Theo Buehler (OpenBSD) for a bugfix patch,
and Theo de Raadt (OpenBSD) for checking it.
* John Gardner for more than a dozen suggestions regarding HTML output.
* Mike Williams for teaching me how to use %%DocumentMedia and
setpagedevice in PostScript files.
* Werner Lemberg (groff) for feedback on mdoc(7) language changes.
* Colin Watson (man-db) for feedback on man-db semantics.
* Jason McIntyre (OpenBSD) for lots of feedback and suggestions
on diagnostic messages and on the documentation.
* Thomas Klausner (NetBSD) for suggesting two new style messages
and one new feature, for two bug reports, and for release testing.
* Leah Neukirchen (Void Linux) for suggesting a new style message,
five bug reports, and release testing.
* Anthony Bentley (OpenBSD) for reporting multiple bugs and missing
features.
* Paul Irofti (OpenBSD) and Nate Bargmann for suggesting new features.
* Michael Stapelberg (Debian) for bug reports and release testing.
* Christian Weisgerber, Jonathan Gray, Stuart Henderson,
Ted Unangst (OpenBSD), Takeshi Nakayama (NetBSD),
Anton Lazarov, Jakub Klinkovsky, Jan Stary, Jesper Wallin,
Will Backmam, and Wolfgang Mueller for bug reports.
* Sevan Janiyan (NetBSD) for additions to lib.in.
* George Brown for suggesting code simplifications.
* David Coppa, Igor Sobrado (OpenBSD), and Alexander Kuleshov
for documentation improvements.
* Laura Morales and Raf Czlonka for questions resulting in better
documentation.
* Yuri Pankov (illumos) for release testing.
Changes in version 1.14.3, released on August 5, 2017
--- BUG FIXES ---

View File

@ -1,6 +1,6 @@
************************************************************************
* Official mandoc TODO.
* $Id: TODO,v 1.246 2017/07/24 11:15:12 schwarze Exp $
* $Id: TODO,v 1.258 2018/08/06 14:16:30 schwarze Exp $
************************************************************************
Many issues are annotated for difficulty as follows:
@ -38,6 +38,18 @@ are mere guesses, and some may be wrong.
--- missing roff features ----------------------------------------------
- .nop prints its arguments as text,
see groff(7) for an example
- .ft CB selects constant-width bold font
see groff_out(7) for examples
- \*(.T prints the device being used,
see groff_char(7) for an example
- \[charNN], \[charNNN] prints a single-byte codepoint
see groff_char(7) for examples
- .ad (adjust margins)
.ad l -- adjust left margin only (flush left)
.ad r -- adjust right margin only (flush right)
@ -52,10 +64,6 @@ are mere guesses, and some may be wrong.
found by naddy@ in xloadimage(1)
loc ** exist *** algo * size * imp *
- .nr third argument (auto-increment step size, requires \n+)
found by bentley@ in sbcl(1) Mon, 9 Dec 2013 18:36:57 -0700
loc * exist * algo * size * imp **
- .ns (no-space mode) occurs in xine-config(1)
when implementing this, also let .TH set it
reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500
@ -65,10 +73,6 @@ are mere guesses, and some may be wrong.
found by jca@ in ratpoison(1) Sun, 30 Jun 2013 12:01:09 +0200
loc * exist ** algo ** size ** imp **
- \n+ and \n- numerical register increment and decrement
found by bentley@ in sbcl(1) Mon, 9 Dec 2013 18:36:57 -0700
loc * exist * algo * size * imp **
- \w'' improve width measurements
would not be very useful without an expression parser, see below
needed for Tcl_NewStringObj(3) via wiz@ Wed, 5 Mar 2014 22:27:43 +0100
@ -87,9 +91,11 @@ are mere guesses, and some may be wrong.
Found by naddy@ in devel/cutils cobfusc(1) Mon, 16 Feb 2015 19:10:52 +0100
loc *** exist *** algo *** size ** imp *
- using undefined strings or macros defines them to be empty
wl@ Mon, 14 Nov 2011 14:37:01 +0000
loc * exist * algo * size * imp *
- check for missing roff escape sequences, implement those that are
trivial even if not usually appearing in manual pages, gracefully
ignore the non-trivial ones, document what they are supposed to do
and what mandoc does instead
loc * exist ** algo * size * imp *
--- missing mdoc features ----------------------------------------------
@ -146,10 +152,6 @@ are mere guesses, and some may be wrong.
is not safe, e.g. `.Bl -column .It Pf a b .' gives "ab."
but should give "ab ."
- check whether it is correct that `D1' uses INDENT+1;
does it need its own constant?
loc * exist ** algo ** size * imp **
- prohibit `Nm' from having non-text HEAD children
(e.g., NetBSD mDNSShared/dns-sd.1)
(mdoc_html.c and mdoc_term.c `Nm' handlers can be slightly simplified)
@ -170,6 +172,25 @@ are mere guesses, and some may be wrong.
uqs@ Thu, 2 Jun 2011 11:33:35 +0200
loc * exist ** algo *** size * imp **
--- missing man features -----------------------------------------------
- .SY and .YS,
used by many groff manual pages
- preserve punctuation following .ME,
see ditroff(7) for an example
- .TQ tagged paragraph continuation,
see groff_diff(7) for examples
- groff_www(7) .MTO and .URL
These macros were used by the GNU grep(1) man page.
The groff_www(7) manual page itself uses them, too.
We should probably *not* add them to mandoc.
Just mentioning this here to keep track of the abuse.
Laura Morales <lauretas at mail dot com> 20 Apr 2018 07:33:02 +0200
loc ** exist * algo * size ** imp *
--- missing tbl features -----------------------------------------------
- the "s" layout column specifier is used for placement of data
@ -177,6 +198,13 @@ are mere guesses, and some may be wrong.
synaptics(4) found by tedu@ Mon, 17 Aug 2015 21:17:42 -0400
loc * exist ** algo *** size * imp **
- vertical centering in cells vertically spanned with ^
pali dot rohar at gmail dot com 16 Jul 2018 13:03:35 +0200
loc * exist *** algo *** size ** imp *
- support .ds requests inside tbl(7) code,
see tbl(1) for an example
- support mdoc(7) and man(7) macros inside tbl(7) code;
probably requires the parser reorg and letting tbl(7)
use roff_node such that macro sets can mix;
@ -195,6 +223,18 @@ are mere guesses, and some may be wrong.
suggested by bentley@ Tue, 14 Oct 2014 04:10:55 -0600
loc * exist ** algo * size * imp **
- implement horizontal and vertical alignment in HTML output
pali dot rohar at gmail dot com 16 Jul 2018 13:03:35 +0200
loc * exist * algo * size * imp ***
- implement cell spanning in HTML output
pali dot rohar at gmail dot com 16 Jul 2018 13:03:35 +0200
loc * exist * algo ** size ** imp **
- implement table borders in HTML output
pali dot rohar at gmail dot com 16 Jul 2018 13:03:35 +0200
loc * exist * algo ** size ** imp **
--- missing eqn features -----------------------------------------------
- In a matrix, break the output line after each matrix line.
@ -219,12 +259,15 @@ are mere guesses, and some may be wrong.
surrounded by blanks, not when it is part of an unquoted word.
Also, check whether there are more such cases (e.g., +?).
reported by bentley@ 20 Jun 2017 02:04:29 -0600
loc * exist ** algo ** size * imp *
- Primes, opprime, and '
bentley@ Thu, 13 Jul 2017 23:14:20 -0600
--- missing misc features ----------------------------------------------
- man -ks 1,8 route; kn@ Jul 13, 2018 orally
- italic correction (\/) in PostScript mode
Werner LEMBERG on groff at gnu dot org Sun, 10 Nov 2013 12:47:46
loc ** exist ** algo * size * imp *
@ -298,6 +341,9 @@ are mere guesses, and some may be wrong.
* formatting issues: ugly output
************************************************************************
- .UR can nest inside .TP,
see roff(7) for examples
- revisit empty in-line macros
look at the difference between "Em x Em ." and "Sq x Em ."
Carsten Kunze Fri, 12 Dec 2014 00:15:41 +0100
@ -375,6 +421,17 @@ are mere guesses, and some may be wrong.
--- HTML issues --------------------------------------------------------
- wrap Sh and Ss content into <div>
Laura Morales <lauretas at mail dot com> 21 Apr 2018 18:10:48 +0200
(Evaluate whether this is really useful and has no adverse
side effects before implementing; if it is possible,
it does seem cleaner.)
loc ** exist ** algo * size * imp ***
- format ".IP *" etc. as <ul> rather than <dl>
https://github.com/Debian/debiman/issues/67
loc ** exist ** algo ** size * imp ***
- .Bf at the beginning of a paragraph inserts a bogus 1ex horizontal
space, see for example random(3). Introduced in
http://mdocml.bsd.lv/cgi-bin/cvsweb/mdoc_html.c.diff?r1=1.91&r2=1.92
@ -471,6 +528,10 @@ are mere guesses, and some may be wrong.
* warning issues
************************************************************************
- warn about duplicate .Sh/.Ss heads
gre(4): Rename duplicate sections 20 Apr 2018 15:27:33 +0200
loc * exist * algo * size * imp **
- style message about macros inside .Bd -literal and .Dl, in particular
font changing macros like .Cm, .Ar, .Fa (from the mdoclint TODO)
@ -509,6 +570,10 @@ are mere guesses, and some may be wrong.
but just the overall format
loc ** exist ** algo *** size ** imp **
- makewhatis -p complains about language subdirectories:
/usr/local/man//ru: Unknown directory part
************************************************************************
* documentation issues
************************************************************************
@ -562,7 +627,7 @@ are mere guesses, and some may be wrong.
- Enable HTTP compression by detecting gzip encoding and filtering
output through libz.
- Sandbox (see OpenSSH).
- Privilege separation (see OpenSSH).
- Enable caching support via HTTP 304 and If-Modified-Since.
- Have Mac OSX systems automatically disable -static compilation of the
CGI: -static isn't supported.
@ -571,6 +636,16 @@ are mere guesses, and some may be wrong.
* to improve in the groff_mdoc(7) macros
************************************************************************
- .Cd # arch1, arch2 in section 4 pages:
find better way to indicate multiple architectures, maybe:
allow .Dt vgafb 4 "macppc sparc64"
already shown as "Device Drivers Manual (macppc sparc64)"
for apropos, make that "vgafb(4) - macppc # sparc64" instead of "- all"
groff can be made to show multiple arches, too, but it is
tedious to do the string parsing in roff code...
jmc@ 23 Apr 2018 07:24:52 +0100 [man for vgafb(4)...]
loc ** exist ** algo * size * imp ***
- use uname(1) to set doc-default-operating-system at install time
tobimensch Mon, 1 Dec 2014 00:25:07 +0100

View File

@ -1,4 +1,4 @@
.\" $Id: apropos.1,v 1.46 2017/07/04 23:40:01 schwarze Exp $
.\" $Id: apropos.1,v 1.47 2018/02/23 18:54:02 schwarze Exp $
.\"
.\" Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2011, 2012, 2014, 2017 Ingo Schwarze <schwarze@openbsd.org>
@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: August 8 2018 $
.Dd $Mdocdate: February 23 2018 $
.Dt APROPOS 1
.Os
.Sh NAME
@ -74,7 +74,7 @@ would.
If the standard output is a terminal device and
.Fl c
is not specified, use
.Xr less 1
.Xr more 1
to paginate them.
In
.Fl a
@ -328,13 +328,36 @@ Text production:
.It Li \&Ox Ta Ox No version reference
.It Li \&Dx Ta Dx No version reference
.El
.Pp
In general, macro keys are supposed to yield complete results without
expecting the user to consider actual macro usage.
For example, results include:
.Pp
.Bl -tag -width 3n -offset 3n -compact
.It Li \&Fa
function arguments appearing on
.Ic \&Fn
lines
.It Li \&Fn
fuction names marked up with
.Ic \&Fo
macros
.It Li \&In
include file names marked up with
.Ic \&Fd
macros
.It Li \&Vt
types appearing as function return types and
.It \&
types appearing in function arguments in the SYNOPSIS
.El
.Sh ENVIRONMENT
.Bl -tag -width MANPAGER
.It Ev MANPAGER
Any non-empty value of the environment variable
.Ev MANPAGER
is used instead of the standard pagination program,
.Xr less 1 ;
.Xr more 1 ;
see
.Xr man 1
for details.
@ -357,7 +380,7 @@ Specifies the pagination program to use when
.Ev MANPAGER
is not defined.
If neither PAGER nor MANPAGER is defined,
.Xr less 1
.Xr more 1
.Fl s
is used.
Only used if

View File

@ -1,4 +1,4 @@
/* $Id: cgi.c,v 1.156 2017/06/24 14:38:32 schwarze Exp $ */
/* $Id: cgi.c,v 1.158 2018/05/29 20:32:45 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@usta.de>
@ -356,6 +356,8 @@ resp_begin_html(int code, const char *msg, const char *file)
"<html>\n"
"<head>\n"
" <meta charset=\"UTF-8\"/>\n"
" <meta name=\"viewport\""
" content=\"width=device-width, initial-scale=1.0\">\n"
" <link rel=\"stylesheet\" href=\"%s/mandoc.css\""
" type=\"text/css\" media=\"all\">\n"
" <title>",
@ -398,7 +400,7 @@ resp_searchform(const struct req *req, enum focus focus)
/* Write query input box. */
printf(" <input type=\"text\" name=\"query\" value=\"");
printf(" <input type=\"search\" name=\"query\" value=\"");
if (req->q.query != NULL)
html_print(req->q.query);
printf( "\" size=\"40\"");
@ -434,7 +436,7 @@ resp_searchform(const struct req *req, enum focus focus)
printf(" selected=\"selected\"");
puts(">All Architectures</option>");
for (i = 0; i < arch_MAX; i++) {
printf(" <option value=\"%s\"", arch_names[i]);
printf(" <option");
if (NULL != req->q.arch &&
0 == strcmp(arch_names[i], req->q.arch))
printf(" selected=\"selected\"");
@ -447,12 +449,10 @@ resp_searchform(const struct req *req, enum focus focus)
if (req->psz > 1) {
puts(" <select name=\"manpath\">");
for (i = 0; i < (int)req->psz; i++) {
printf(" <option ");
printf(" <option");
if (strcmp(req->q.manpath, req->p[i]) == 0)
printf("selected=\"selected\" ");
printf("value=\"");
html_print(req->p[i]);
printf("\">");
printf(" selected=\"selected\"");
printf(">");
html_print(req->p[i]);
puts("</option>");
}

View File

@ -1,4 +1,4 @@
/* $Id: chars.c,v 1.71 2017/06/14 20:57:07 schwarze Exp $ */
/* $Id: chars.c,v 1.73 2017/08/23 13:01:29 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@ -70,17 +70,17 @@ static struct ln lines[] = {
/* Text markers. */
{ "ci", "O", 0x25cb },
{ "bu", "+\bo", 0x2022 },
{ "dd", "|\b=", 0x2021 },
{ "dg", "|\b-", 0x2020 },
{ "dd", "<**>", 0x2021 },
{ "dg", "<*>", 0x2020 },
{ "lz", "<>", 0x25ca },
{ "sq", "[]", 0x25a1 },
{ "ps", "<par>", 0x00b6 },
{ "sc", "<sec>", 0x00a7 },
{ "ps", "<paragraph>", 0x00b6 },
{ "sc", "<section>", 0x00a7 },
{ "lh", "<=", 0x261c },
{ "rh", "=>", 0x261e },
{ "at", "@", 0x0040 },
{ "sh", "#", 0x0023 },
{ "CR", "_|", 0x21b5 },
{ "CR", "<cr>", 0x21b5 },
{ "OK", "\\/", 0x2713 },
{ "CL", "<club>", 0x2663 },
{ "SP", "<spade>", 0x2660 },
@ -173,11 +173,11 @@ static struct ln lines[] = {
{ "OR", "v", 0x2228 },
{ "no", "~", 0x00ac },
{ "tno", "~", 0x00ac },
{ "te", "3", 0x2203 },
{ "fa", "-\bV", 0x2200 },
{ "st", "-)", 0x220b },
{ "tf", ".:.", 0x2234 },
{ "3d", ".:.", 0x2234 },
{ "te", "<there\037exists>", 0x2203 },
{ "fa", "<for\037all>", 0x2200 },
{ "st", "<such\037that>", 0x220b },
{ "tf", "<therefore>", 0x2234 },
{ "3d", "<therefore>", 0x2234 },
{ "or", "|", 0x007c },
/* Mathematicals. */
@ -193,8 +193,8 @@ static struct ln lines[] = {
{ "tmu", "x", 0x00d7 },
{ "c*", "O\bx", 0x2297 },
{ "c+", "O\b+", 0x2295 },
{ "di", "-:-", 0x00f7 },
{ "tdi", "-:-", 0x00f7 },
{ "di", "/", 0x00f7 },
{ "tdi", "/", 0x00f7 },
{ "f/", "/", 0x2044 },
{ "**", "*", 0x2217 },
{ "<=", "<=", 0x2264 },
@ -210,38 +210,38 @@ static struct ln lines[] = {
{ "=~", "=~", 0x2245 },
{ "~~", "~~", 0x2248 },
{ "~=", "~=", 0x2248 },
{ "pt", "oc", 0x221d },
{ "pt", "<proportional\037to>", 0x221d },
{ "es", "{}", 0x2205 },
{ "mo", "E", 0x2208 },
{ "nm", "!E", 0x2209 },
{ "sb", "(=", 0x2282 },
{ "nb", "(!=", 0x2284 },
{ "sp", "=)", 0x2283 },
{ "nc", "!=)", 0x2285 },
{ "ib", "(=\b_", 0x2286 },
{ "ip", "=\b_)", 0x2287 },
{ "ca", "(^)", 0x2229 },
{ "cu", "U", 0x222a },
{ "/_", "_\b/", 0x2220 },
{ "pp", "_\b|", 0x22a5 },
{ "is", "'\b,\bI", 0x222b },
{ "integral", "'\b,\bI", 0x222b },
{ "sum", "E", 0x2211 },
{ "product", "TT", 0x220f },
{ "coproduct", "U", 0x2210 },
{ "gr", "V", 0x2207 },
{ "sr", "\\/", 0x221a },
{ "sqrt", "\\/", 0x221a },
{ "mo", "<element\037of>", 0x2208 },
{ "nm", "<not\037element\037of>", 0x2209 },
{ "sb", "<proper\037subset>", 0x2282 },
{ "nb", "<not\037subset>", 0x2284 },
{ "sp", "<proper\037superset>", 0x2283 },
{ "nc", "<not\037superset>", 0x2285 },
{ "ib", "<subset\037or\037equal>", 0x2286 },
{ "ip", "<superset\037or\037equal>", 0x2287 },
{ "ca", "<intersection>", 0x2229 },
{ "cu", "<union>", 0x222a },
{ "/_", "<angle>", 0x2220 },
{ "pp", "<perpendicular>", 0x22a5 },
{ "is", "<integral>", 0x222b },
{ "integral", "<integral>", 0x222b },
{ "sum", "<sum>", 0x2211 },
{ "product", "<product>", 0x220f },
{ "coproduct", "<coproduct>", 0x2210 },
{ "gr", "<nabla>", 0x2207 },
{ "sr", "<sqrt>", 0x221a },
{ "sqrt", "<sqrt>", 0x221a },
{ "lc", "|~", 0x2308 },
{ "rc", "~|", 0x2309 },
{ "lf", "|_", 0x230a },
{ "rf", "_|", 0x230b },
{ "if", "oo", 0x221e },
{ "Ah", "N", 0x2135 },
{ "Im", "I", 0x2111 },
{ "Re", "R", 0x211c },
{ "if", "<infinity>", 0x221e },
{ "Ah", "<Aleph>", 0x2135 },
{ "Im", "<Im>", 0x2111 },
{ "Re", "<Re>", 0x211c },
{ "wp", "P", 0x2118 },
{ "pd", "a", 0x2202 },
{ "pd", "<del>", 0x2202 },
{ "-h", "/h", 0x210f },
{ "hbar", "/h", 0x210f },
{ "12", "1/2", 0x00bd },
@ -251,9 +251,9 @@ static struct ln lines[] = {
{ "38", "3/8", 0x215C },
{ "58", "5/8", 0x215D },
{ "78", "7/8", 0x215E },
{ "S1", "1", 0x00B9 },
{ "S2", "2", 0x00B2 },
{ "S3", "3", 0x00B3 },
{ "S1", "^1", 0x00B9 },
{ "S2", "^2", 0x00B2 },
{ "S3", "^3", 0x00B3 },
/* Ligatures. */
{ "ff", "ff", 0xfb00 },
@ -346,8 +346,8 @@ static struct ln lines[] = {
{ "oa", "o\ba", 0x00e5 },
/* Special letters. */
{ "-D", "-\bD", 0x00d0 },
{ "Sd", "d", 0x00f0 },
{ "-D", "Dh", 0x00d0 },
{ "Sd", "dh", 0x00f0 },
{ "TP", "Th", 0x00de },
{ "Tp", "th", 0x00fe },
{ ".i", "i", 0x0131 },
@ -364,68 +364,68 @@ static struct ln lines[] = {
{ "Fn", ",\bf", 0x0192 },
/* Units. */
{ "de", "<deg>", 0x00b0 },
{ "%0", "%o", 0x2030 },
{ "de", "<degree>", 0x00b0 },
{ "%0", "<permille>", 0x2030 },
{ "fm", "\'", 0x2032 },
{ "sd", "''", 0x2033 },
{ "mc", ",\bu", 0x00b5 },
{ "mc", "<micro>", 0x00b5 },
{ "Of", "_\ba", 0x00aa },
{ "Om", "_\bo", 0x00ba },
/* Greek characters. */
{ "*A", "A", 0x0391 },
{ "*B", "B", 0x0392 },
{ "*G", "G", 0x0393 },
{ "*D", "_\b/_\b\\", 0x0394 },
{ "*G", "<Gamma>", 0x0393 },
{ "*D", "<Delta>", 0x0394 },
{ "*E", "E", 0x0395 },
{ "*Z", "Z", 0x0396 },
{ "*Y", "H", 0x0397 },
{ "*H", "-\bO", 0x0398 },
{ "*H", "<Theta>", 0x0398 },
{ "*I", "I", 0x0399 },
{ "*K", "K", 0x039a },
{ "*L", "/\\", 0x039b },
{ "*L", "<Lambda>", 0x039b },
{ "*M", "M", 0x039c },
{ "*N", "N", 0x039d },
{ "*C", "_\bH", 0x039e },
{ "*C", "<Xi>", 0x039e },
{ "*O", "O", 0x039f },
{ "*P", "TT", 0x03a0 },
{ "*P", "<Pi>", 0x03a0 },
{ "*R", "P", 0x03a1 },
{ "*S", "S", 0x03a3 },
{ "*S", "<Sigma>", 0x03a3 },
{ "*T", "T", 0x03a4 },
{ "*U", "Y", 0x03a5 },
{ "*F", "I\bO", 0x03a6 },
{ "*F", "<Phi>", 0x03a6 },
{ "*X", "X", 0x03a7 },
{ "*Q", "I\bY", 0x03a8 },
{ "*W", "_\bO", 0x03a9 },
{ "*a", "a", 0x03b1 },
{ "*b", "B", 0x03b2 },
{ "*g", "y", 0x03b3 },
{ "*d", "d", 0x03b4 },
{ "*e", "e", 0x03b5 },
{ "*z", ",\bC", 0x03b6 },
{ "*y", "n", 0x03b7 },
{ "*h", "-\b0", 0x03b8 },
{ "*i", "i", 0x03b9 },
{ "*k", "k", 0x03ba },
{ "*l", ">\b\\", 0x03bb },
{ "*m", ",\bu", 0x03bc },
{ "*n", "v", 0x03bd },
{ "*c", ",\bE", 0x03be },
{ "*Q", "<Psi>", 0x03a8 },
{ "*W", "<Omega>", 0x03a9 },
{ "*a", "<alpha>", 0x03b1 },
{ "*b", "<beta>", 0x03b2 },
{ "*g", "<gamma>", 0x03b3 },
{ "*d", "<delta>", 0x03b4 },
{ "*e", "<epsilon>", 0x03b5 },
{ "*z", "<zeta>", 0x03b6 },
{ "*y", "<eta>", 0x03b7 },
{ "*h", "<theta>", 0x03b8 },
{ "*i", "<iota>", 0x03b9 },
{ "*k", "<kappa>", 0x03ba },
{ "*l", "<lambda>", 0x03bb },
{ "*m", "<mu>", 0x03bc },
{ "*n", "<nu>", 0x03bd },
{ "*c", "<xi>", 0x03be },
{ "*o", "o", 0x03bf },
{ "*p", "-\bn", 0x03c0 },
{ "*r", "p", 0x03c1 },
{ "*s", "-\bo", 0x03c3 },
{ "*t", "~\bt", 0x03c4 },
{ "*u", "u", 0x03c5 },
{ "*f", "|\bo", 0x03d5 },
{ "*x", "x", 0x03c7 },
{ "*q", "|\bu", 0x03c8 },
{ "*w", "w", 0x03c9 },
{ "+h", "-\b0", 0x03d1 },
{ "+f", "|\bo", 0x03c6 },
{ "+p", "-\bw", 0x03d6 },
{ "+e", "e", 0x03f5 },
{ "ts", "s", 0x03c2 },
{ "*p", "<pi>", 0x03c0 },
{ "*r", "<rho>", 0x03c1 },
{ "*s", "<sigma>", 0x03c3 },
{ "*t", "<tau>", 0x03c4 },
{ "*u", "<upsilon>", 0x03c5 },
{ "*f", "<phi>", 0x03d5 },
{ "*x", "<chi>", 0x03c7 },
{ "*q", "<psi>", 0x03c8 },
{ "*w", "<omega>", 0x03c9 },
{ "+h", "<theta>", 0x03d1 },
{ "+f", "<phi>", 0x03c6 },
{ "+p", "<pi>", 0x03d6 },
{ "+e", "<epsilon>", 0x03f5 },
{ "ts", "<sigma>", 0x03c2 },
};
static struct ohash mchars;

View File

@ -0,0 +1,50 @@
#include "config.h"
#if HAVE_STRNDUP
int dummy;
#else
/* $Id: compat_strndup.c,v 1.1 2018/02/27 11:16:23 schwarze Exp $ */
/* OpenBSD: strndup.c,v 1.2 2015/08/31 02:53:57 guenther Exp */
/*
* Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
*
* 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 <sys/types.h>
#include <stdlib.h>
#include <string.h>
char *
strndup(const char *str, size_t maxlen)
{
char *copy;
size_t len;
for (len = 0; len < maxlen && str[len] != '\0'; len++)
continue;
copy = malloc(len + 1);
if (copy != NULL) {
(void)memcpy(copy, str, len);
copy[len] = '\0';
}
return copy;
}
#endif

View File

@ -38,6 +38,7 @@
#define HAVE_STRINGLIST 1
#define HAVE_STRLCAT 1
#define HAVE_STRLCPY 1
#define HAVE_STRNDUP 1
#define HAVE_STRPTIME 1
#define HAVE_STRSEP 1
#define HAVE_STRTONUM 1
@ -47,6 +48,7 @@
#define HAVE_OHASH 1
#define BINM_APROPOS "apropos"
#define BINM_CATMAN "catman"
#define BINM_MAKEWHATIS "makewhatis"
#define BINM_MAN "man"
#define BINM_SOELIM "soelim"

View File

@ -1,8 +1,8 @@
#!/bin/sh
#
# $Id: configure,v 1.64 2017/07/01 09:47:30 schwarze Exp $
# $Id: configure,v 1.66 2018/07/31 15:34:00 schwarze Exp $
#
# Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
# Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@ -27,7 +27,7 @@ set -e
# 3: config.log
exec 3> config.log
echo "config.log: writing..."
echo "file config.log: writing..."
# --- default settings -------------------------------------------------
# Initialize all variables here,
@ -41,14 +41,13 @@ OSNAME=
UTF8_LOCALE=
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
CFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings"
CFLAGS="${CFLAGS} -Wno-unused-parameter"
CFLAGS=
LDADD=
LDFLAGS=
LD_NANOSLEEP=
LD_OHASH=
LD_RECVMSG=
STATIC="-static"
STATIC=
BUILD_CGI=0
BUILD_CATMAN=0
@ -83,6 +82,7 @@ HAVE_STRCASESTR=
HAVE_STRINGLIST=
HAVE_STRLCAT=
HAVE_STRLCPY=
HAVE_STRNDUP=
HAVE_STRPTIME=
HAVE_STRSEP=
HAVE_STRTONUM=
@ -126,27 +126,25 @@ LN="ln -f"
# --- manual settings from configure.local -----------------------------
if [ -r ./configure.local ]; then
echo "configure.local: reading..." 1>&2
echo "configure.local: reading..." 1>&3
echo "file configure.local: reading..." 1>&2
echo "file configure.local: reading..." 1>&3
cat ./configure.local 1>&3
. ./configure.local
else
echo "configure.local: no (fully automatic configuration)" 1>&2
echo "configure.local: no (fully automatic configuration)" 1>&3
echo "file configure.local: no (fully automatic configuration)" 1>&2
echo "file configure.local: no (fully automatic configuration)" 1>&3
fi
echo 1>&3
# --- tests for config.h ----------------------------------------------
COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
# --- tests functions --------------------------------------------------
# Check whether this HAVE_ setting is manually overridden.
# If yes, use the override, if no, do not decide anything yet.
# Arguments: lower-case test name, manual value
# Arguments: test file name, test var name, manual value
ismanual() {
[ -z "${3}" ] && return 1
echo "${1}: manual (HAVE_${2}=${3})" 1>&2
echo "${1}: manual (HAVE_${2}=${3})" 1>&3
echo "tested ${1}: HAVE_${2}=${3} (manual)" 1>&2
echo "tested ${1}: HAVE_${2}=${3} (manual)" 1>&3
echo 1>&3
return 0
}
@ -154,31 +152,33 @@ ismanual() {
# Run a single autoconfiguration test.
# In case of success, enable the feature.
# In case of failure, do not decide anything yet.
# Arguments: lower-case test name, upper-case test name, additional CFLAGS
# Arguments: test file name, test var name, additional CFLAGS
singletest() {
cat 1>&3 << __HEREDOC__
${1}${3}: testing...
testing ${1}${3} ...
${COMP} -o test-${1} test-${1}.c ${3}
__HEREDOC__
if ${COMP} -o "test-${1}" "${SOURCEDIR}/test-${1}.c" ${3} 1>&3 2>&3
then
echo "${1}${3}: ${CC} succeeded" 1>&3
echo "partial result of ${1}${3}: ${CC} succeeded" 1>&3
else
echo "${1}${3}: ${CC} failed with $?" 1>&3
echo "result of ${1}${3}: ${CC} failed with exit status $?" 1>&3
echo "result of compiling ${1}${3}: no" 1>&3
echo 1>&3
return 1
fi
if ./test-${1} 1>&3 2>&3; then
echo "${1}${3}: yes" 1>&2
echo "${1}${3}: yes" 1>&3
echo "tested ${1}${3}: yes" 1>&2
echo "result of running ${1}${3}: yes" 1>&3
echo 1>&3
eval HAVE_${2}=1
rm "test-${1}"
return 0
else
echo "${1}${3}: execution failed with $?" 1>&3
echo "result of ${1}${3}: execution failed with exit status $?" 1>&3
echo "result of running ${1}${3}: no" 1>&3
echo 1>&3
rm "test-${1}"
return 1
@ -187,12 +187,12 @@ __HEREDOC__
# Run a complete autoconfiguration test, including the check for
# a manual override and disabling the feature on failure.
# Arguments: lower case name, upper case name, additional CFLAGS
# Arguments: test file name, test var name, additional CFLAGS
runtest() {
eval _manual=\${HAVE_${2}}
ismanual "${1}" "${2}" "${_manual}" && return 0
singletest "${1}" "${2}" "${3}" && return 0
echo "${1}${3}: no" 1>&2
echo "tested ${1}${3}: no" 1>&2
eval HAVE_${2}=0
return 1
}
@ -201,18 +201,54 @@ runtest() {
get_locale() {
[ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0
ismanual UTF8_LOCALE UTF8_LOCALE "$UTF8_LOCALE" && return 0
echo "UTF8_LOCALE: testing..." 1>&3
echo "testing UTF8_LOCALE ..." 1>&3
UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1`
if [ -z "${UTF8_LOCALE}" ]; then
UTF8_LOCALE=`locale -a | grep -i '\.UTF-*8' | head -n 1`
[ -n "${UTF8_LOCALE}" ] || return 1
fi
echo "UTF8_LOCALE=${UTF8_LOCALE}" 1>&2
echo "UTF8_LOCALE=${UTF8_LOCALE}" 1>&3
echo "selected UTF8_LOCALE=${UTF8_LOCALE}" 1>&2
echo "selected UTF8_LOCALE=${UTF8_LOCALE}" 1>&3
echo 1>&3
return 0;
}
# --- compiler options -------------------------------------------------
if [ -n "${CFLAGS}" ]; then
COMP="${CC} ${CFLAGS}"
echo "selected CFLAGS=\"${CFLAGS}\" (manual)" 1>&2
echo "selected CFLAGS=\"${CFLAGS}\" (manual)" 1>&3
echo 1>&3
else
CFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes"
CFLAGS="${CFLAGS} -Wwrite-strings -Wno-unused-parameter"
COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
echo -n "tested ${CC} -W: " 1>&2
echo -n "testing ${CC} -W: " 1>&3
runtest noop WFLAG || true
if [ "${HAVE_WFLAG}" -eq 0 ]; then
CFLAGS="-g"
COMP="${CC} ${CFLAGS}"
fi
echo "selected CFLAGS=\"${CFLAGS}\"" 1>&2
echo "selected CFLAGS=\"${CFLAGS}\"" 1>&3
echo 1>&3
fi
if [ -n "${STATIC}" ]; then
echo "selected STATIC=\"${STATIC}\" (manual)" 1>&2
echo "selected STATIC=\"${STATIC}\" (manual)" 1>&3
echo 1>&3
else
runtest noop STATIC -static || true
[ ${HAVE_STATIC} -eq 0 ] || STATIC="-static"
echo "selected STATIC=\"${STATIC}\"" 1>&2
echo "selected STATIC=\"${STATIC}\"" 1>&3
echo 1>&3
fi
# --- tests for config.h ----------------------------------------------
# --- library functions ---
runtest dirent-namlen DIRENT_NAMLEN || true
@ -238,6 +274,7 @@ runtest strcasestr STRCASESTR || true
runtest stringlist STRINGLIST || true
runtest strlcat STRLCAT || true
runtest strlcpy STRLCPY || true
runtest strndup STRNDUP || true
runtest strptime STRPTIME || true
runtest strsep STRSEP || true
runtest strtonum STRTONUM || true
@ -264,8 +301,9 @@ if get_locale; then
runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true
else
HAVE_WCHAR=0
echo "wchar: no (no UTF8_LOCALE)" 1>&2
echo "wchar: no (no UTF8_LOCALE)" 1>&3
echo "tested wchar: no (no UTF8_LOCALE)" 1>&2
echo "tested wchar: no (no UTF8_LOCALE)" 1>&3
echo 1>&3
fi
# --- nanosleep ---
@ -328,8 +366,8 @@ fi
# --- LDADD ---
LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz"
echo "LDADD=\"${LDADD}\"" 1>&2
echo "LDADD=\"${LDADD}\"" 1>&3
echo "selected LDADD=\"${LDADD}\"" 1>&2
echo "selected LDADD=\"${LDADD}\"" 1>&3
echo 1>&3
# --- write config.h ---
@ -353,7 +391,8 @@ __HEREDOC__
[ ${HAVE_GETLINE} -eq 0 -o \
${HAVE_REALLOCARRAY} -eq 0 -o ${HAVE_RECALLOCARRAY} -eq 0 -o \
${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 ] \
${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 -o \
${HAVE_STRNDUP} -eq 0 ] \
&& echo "#include <sys/types.h>"
[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
[ ${HAVE_GETLINE} -eq 0 ] && echo "#include <stdio.h>"
@ -396,6 +435,7 @@ cat << __HEREDOC__
#define HAVE_STRINGLIST ${HAVE_STRINGLIST}
#define HAVE_STRLCAT ${HAVE_STRLCAT}
#define HAVE_STRLCPY ${HAVE_STRLCPY}
#define HAVE_STRNDUP ${HAVE_STRNDUP}
#define HAVE_STRPTIME ${HAVE_STRPTIME}
#define HAVE_STRSEP ${HAVE_STRSEP}
#define HAVE_STRTONUM ${HAVE_STRTONUM}
@ -452,6 +492,9 @@ fi
[ ${HAVE_STRLCPY} -eq 0 ] && \
echo "extern size_t strlcpy(char *, const char *, size_t);"
[ ${HAVE_STRNDUP} -eq 0 ] && \
echo "extern char *strndup(const char *, size_t);"
[ ${HAVE_STRSEP} -eq 0 ] && \
echo "extern char *strsep(char **, const char *);"
@ -461,8 +504,8 @@ fi
[ ${HAVE_VASPRINTF} -eq 0 ] && \
echo "extern int vasprintf(char **, const char *, va_list);"
echo "config.h: written" 1>&2
echo "config.h: written" 1>&3
echo "file config.h: written" 1>&2
echo "file config.h: written" 1>&3
# --- tests for Makefile.local -----------------------------------------
@ -531,7 +574,7 @@ INSTALL_DATA = ${INSTALL_DATA}
LN = ${LN}
__HEREDOC__
echo "Makefile.local: written" 1>&2
echo "Makefile.local: written" 1>&3
echo "file Makefile.local: written" 1>&2
echo "file Makefile.local: written" 1>&3
exit 0

View File

@ -1,6 +1,6 @@
# $Id: configure.local.example,v 1.33 2017/07/20 16:24:53 schwarze Exp $
# $Id: configure.local.example,v 1.34 2018/07/31 15:34:00 schwarze Exp $
#
# Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
# Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@ -77,7 +77,7 @@ MANPATH_BASE="/usr/share/man:/usr/X11R6/man"
# If you do not want uname(3) to be called but instead want a fixed
# string to be used, use the following line:
OSNAME="OpenBSD 6.0"
OSNAME="OpenBSD 6.3"
# The following installation directories are used.
# It is possible to set only one or a few of these variables,
@ -100,6 +100,7 @@ BIN_FROM_SBIN="../bin"
# Some distributions may want to avoid naming conflicts
# with the configuration files of other man(1) implementations.
# This changes the name of the installed section 5 manual page as well.
MANM_MANCONF="mandoc.conf" # default is "man.conf"
# Some distributions may want to avoid naming conflicts among manuals.
@ -148,13 +149,6 @@ LN="ln -sf" # default is "ln -f"
LD_OHASH="-lutil"
# When library autodetection decides to use -L/usr/local/lib,
# -I/usr/local/include is automatically added to CFLAGS.
# If you manually set LD_OHASH to something including -L/usr/local/lib,
# chances are you will also need the following line:
CFLAGS="${CFLAGS} -I/usr/local/include"
# Some platforms may need an additional linker flag for nanosleep(2).
# If none is needed or it is -lrt, it is autodetected.
# Otherwise, set the following variable.
@ -222,16 +216,22 @@ BUILD_CGI=1
# The remaining settings in this section are only relevant if BUILD_CGI
# is enabled. Otherwise, they have no effect either way.
# By default, man.cgi(8) is linked statically.
# Some systems do not support static linking, for example Mac OS X.
# In that case, use the following line:
# By default, man.cgi(8) is linked statically if the compiler supports
# the -static option. If automatic detection fails, you can force
# static linking of man.cgi(8).
STATIC=
STATIC="-static"
# Some systems, for example Linux, require -pthread for static linking:
# Some systems may require -pthread for static linking:
STATIC="-static -pthread"
# If static linking works in general but not with additional libraries
# like -lrt or -lz, you can force dynamic linking. This may for
# example be required on SunOS 5.9.
STATIC=" "
# Some directories.
# This works just like PREFIX, see above.
@ -263,15 +263,19 @@ BINM_CATMAN=mcatman # default is "catman"
CC=cc
# Because the system compiler may not provide <stdint.h>,
# SunOS 5.9 may need:
CC=gcc
# IBM AIX may need:
CC=xlc
# The default compiler flags are:
CFLAGS="-g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings"
# IBM AIX xlc does not support -W; in that case, please use:
# Normally, leave CFLAGS unset. In that case, -g will automatically
# be used, and various -W options will be added if the compiler
# supports them. If you define CFLAGS manually, it will be used
# unchanged, and nothing will be added.
CFLAGS="-g"

View File

@ -1,4 +1,4 @@
.\" $Id: eqn.7,v 1.36 2017/07/20 11:07:27 schwarze Exp $
.\" $Id: eqn.7,v 1.37 2017/09/04 10:35:27 schwarze Exp $
.\"
.\" Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: July 20 2017 $
.Dd $Mdocdate: September 4 2017 $
.Dt EQN 7
.Os
.Sh NAME
@ -83,7 +83,7 @@ box : text
| \(dqsqrt\(dq box
| box pos box
| box mark
| \(dqmatrix\(dq \(dq{\(dq [col \(dq{\(dq list \(dq}\(dq ]*
| \(dqmatrix\(dq \(dq{\(dq [col \(dq{\(dq list \(dq}\(dq]* \(dq}\(dq
| pile \(dq{\(dq list \(dq}\(dq
| font box
| \(dqsize\(dq text box

View File

@ -1,4 +1,4 @@
/* $Id: eqn_term.c,v 1.13 2017/07/08 14:51:04 schwarze Exp $ */
/* $Id: eqn_term.c,v 1.17 2017/08/23 21:56:20 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@ -20,6 +20,7 @@
#include <sys/types.h>
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -51,6 +52,7 @@ static void
eqn_box(struct termp *p, const struct eqn_box *bp)
{
const struct eqn_box *child;
const char *cp;
int delim;
/* Delimiters around this box? */
@ -67,7 +69,16 @@ eqn_box(struct termp *p, const struct eqn_box *bp)
((bp->parent->type == EQN_LIST && bp->expectargs == 1) ||
(bp->parent->type == EQN_SUBEXPR &&
bp->pos != EQNPOS_SQRT)))))) {
if (bp->parent->type == EQN_SUBEXPR && bp->prev != NULL)
if ((bp->parent->type == EQN_SUBEXPR && bp->prev != NULL) ||
(bp->type == EQN_LIST &&
bp->first != NULL &&
bp->first->type != EQN_PILE &&
bp->first->type != EQN_MATRIX &&
bp->prev != NULL &&
(bp->prev->type == EQN_LIST ||
(bp->prev->type == EQN_TEXT &&
(*bp->prev->text == '\\' ||
isalpha((unsigned char)*bp->prev->text))))))
p->flags |= TERMP_NOSPACE;
term_word(p, bp->left != NULL ? bp->left : "(");
p->flags |= TERMP_NOSPACE;
@ -80,8 +91,17 @@ eqn_box(struct termp *p, const struct eqn_box *bp)
if (bp->font != EQNFONT_NONE)
term_fontpush(p, fontmap[(int)bp->font]);
if (bp->text != NULL)
if (bp->text != NULL) {
if (strchr("!\"'),.:;?]}", *bp->text) != NULL)
p->flags |= TERMP_NOSPACE;
term_word(p, bp->text);
if ((cp = strchr(bp->text, '\0')) > bp->text &&
(strchr("\"'([{", cp[-1]) != NULL ||
(bp->prev == NULL && (cp[-1] == '-' ||
(cp >= bp->text + 5 &&
strcmp(cp - 5, "\\[mi]") == 0)))))
p->flags |= TERMP_NOSPACE;
}
/* Special box types. */
@ -98,9 +118,9 @@ eqn_box(struct termp *p, const struct eqn_box *bp)
term_word(p, bp->pos == EQNPOS_OVER ? "/" :
(bp->pos == EQNPOS_SUP ||
bp->pos == EQNPOS_TO) ? "^" : "_");
p->flags |= TERMP_NOSPACE;
child = child->next;
if (child != NULL) {
p->flags |= TERMP_NOSPACE;
eqn_box(p, child);
if (bp->pos == EQNPOS_FROMTO ||
bp->pos == EQNPOS_SUBSUP) {

View File

@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
# Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@ -19,7 +19,7 @@ if [ `id -u` -eq 0 ]; then
fi
if [ $# -eq 0 ]; then
echo "usage: $0 [-h] manual_source_file ..."
echo "usage: $0 [-h|-u] manual_source_file ..."
exit 1
fi
@ -28,22 +28,25 @@ if [ "X$1" = "X-h" ]; then
export PATH="/usr/local/heirloom-doctools/bin:$PATH"
EQN="neqn"
ROFF="nroff"
MOPT="-Omdoc $MOPT"
MOPT="-Ios=BSD -Tascii $MOPT"
COLPIPE="col -b"
elif [ "X$1" = "X-u" ]; then
shift
ROFF="groff -ket -ww -Tutf8 -P -c"
MOPT="-Werror -Tutf8 $MOPT"
MOPT="-Ios=OpenBSD -Wall -Tutf8 $MOPT"
COLPIPE="cat"
else
ROFF="groff -et -ww -Tascii -P -c"
MOPT="-Werror -Tascii $MOPT"
ROFF="groff -et -ww -mtty-char -Tascii -P -c"
MOPT="-Ios=OpenBSD -Wall -Tascii $MOPT"
COLPIPE="cat"
fi
while [ -n "$1" ]; do
file=$1
shift
echo " ========== $file ========== "
$ROFF -mandoc $file 2> /tmp/roff.err > /tmp/roff.out
${MANDOC:=mandoc} -Ios=OpenBSD $MOPT $file \
$ROFF -mandoc $file | $COLPIPE 2> /tmp/roff.err > /tmp/roff.out
${MANDOC:=mandoc} $MOPT $file | $COLPIPE \
2> /tmp/mandoc.err > /tmp/mandoc.out
for i in roff mandoc; do
[ -s /tmp/$i.err ] && echo "$i errors:" && cat /tmp/$i.err

View File

@ -1,7 +1,7 @@
/* $Id: html.c,v 1.219 2017/07/15 17:57:51 schwarze Exp $ */
/* $Id: html.c,v 1.238 2018/06/25 16:54:59 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -22,6 +22,7 @@
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
@ -29,6 +30,7 @@
#include <unistd.h>
#include "mandoc_aux.h"
#include "mandoc_ohash.h"
#include "mandoc.h"
#include "roff.h"
#include "out.h"
@ -59,6 +61,7 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"meta", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL},
{"title", HTML_NLAROUND},
{"div", HTML_NLAROUND},
{"div", 0},
{"h1", HTML_NLAROUND},
{"h2", HTML_NLAROUND},
{"span", 0},
@ -66,8 +69,6 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"br", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL},
{"a", 0},
{"table", HTML_NLALL | HTML_INDENT},
{"colgroup", HTML_NLALL | HTML_INDENT},
{"col", HTML_NOSTACK | HTML_AUTOCLOSE | HTML_NLALL},
{"tr", HTML_NLALL | HTML_INDENT},
{"td", HTML_NLAROUND},
{"li", HTML_NLAROUND | HTML_INDENT},
@ -103,20 +104,9 @@ static const struct htmldata htmltags[TAG_MAX] = {
{"mover", 0},
};
static const char *const roffscales[SCALE_MAX] = {
"cm", /* SCALE_CM */
"in", /* SCALE_IN */
"pc", /* SCALE_PC */
"pt", /* SCALE_PT */
"em", /* SCALE_EM */
"em", /* SCALE_MM */
"ex", /* SCALE_EN */
"ex", /* SCALE_BU */
"em", /* SCALE_VS */
"ex", /* SCALE_FS */
};
/* Avoid duplicate HTML id= attributes. */
static struct ohash id_unique;
static void a2width(const char *, struct roffsu *);
static void print_byte(struct html *, char);
static void print_endword(struct html *);
static void print_indent(struct html *);
@ -143,6 +133,8 @@ html_alloc(const struct manoutput *outopts)
if (outopts->fragment)
h->oflags |= HTML_FRAGMENT;
mandoc_ohash_init(&id_unique, 4, 0);
return h;
}
@ -151,15 +143,22 @@ html_free(void *p)
{
struct tag *tag;
struct html *h;
char *cp;
unsigned int slot;
h = (struct html *)p;
while ((tag = h->tag) != NULL) {
h->tag = tag->next;
free(tag);
}
free(h);
cp = ohash_first(&id_unique, &slot);
while (cp != NULL) {
free(cp);
cp = ohash_next(&id_unique, &slot);
}
ohash_delete(&id_unique);
}
void
@ -168,9 +167,14 @@ print_gen_head(struct html *h)
struct tag *t;
print_otag(h, TAG_META, "?", "charset", "utf-8");
if (h->style != NULL) {
print_otag(h, TAG_LINK, "?h??", "rel", "stylesheet",
h->style, "type", "text/css", "media", "all");
return;
}
/*
* Print a default style-sheet.
* Print a minimal embedded style sheet.
*/
t = print_otag(h, TAG_STYLE, "");
@ -181,11 +185,23 @@ print_gen_head(struct html *h)
print_text(h, "td.head-vol { text-align: center; }");
print_endline(h);
print_text(h, "div.Pp { margin: 1ex 0ex; }");
print_endline(h);
print_text(h, "div.Nd, div.Bf, div.Op { display: inline; }");
print_endline(h);
print_text(h, "span.Pa, span.Ad { font-style: italic; }");
print_endline(h);
print_text(h, "span.Ms { font-weight: bold; }");
print_endline(h);
print_text(h, "dl.Bl-diag ");
print_byte(h, '>');
print_text(h, " dt { font-weight: bold; }");
print_endline(h);
print_text(h, "code.Nm, code.Fl, code.Cm, code.Ic, "
"code.In, code.Fd, code.Fn,");
print_endline(h);
print_text(h, "code.Cd { font-weight: bold; "
"font-family: inherit; }");
print_tagq(h, t);
if (h->style)
print_otag(h, TAG_LINK, "?h??", "rel", "stylesheet",
h->style, "type", "text/css", "media", "all");
}
static void
@ -239,10 +255,12 @@ print_metaf(struct html *h, enum mandoc_esc deco)
}
char *
html_make_id(const struct roff_node *n)
html_make_id(const struct roff_node *n, int unique)
{
const struct roff_node *nch;
char *buf, *cp;
char *buf, *bufs, *cp;
unsigned int slot;
int suffix;
for (nch = n->child; nch != NULL; nch = nch->next)
if (nch->type != ROFFT_TEXT)
@ -250,65 +268,46 @@ html_make_id(const struct roff_node *n)
buf = NULL;
deroff(&buf, n);
/* http://www.w3.org/TR/html5/dom.html#the-id-attribute */
for (cp = buf; *cp != '\0'; cp++)
if (*cp == ' ')
*cp = '_';
return buf;
}
int
html_strlen(const char *cp)
{
size_t rsz;
int skip, sz;
if (buf == NULL)
return NULL;
/*
* Account for escaped sequences within string length
* calculations. This follows the logic in term_strlen() as we
* must calculate the width of produced strings.
* Assume that characters are always width of "1". This is
* hacky, but it gets the job done for approximation of widths.
* In ID attributes, only use ASCII characters that are
* permitted in URL-fragment strings according to the
* explicit list at:
* https://url.spec.whatwg.org/#url-fragment-string
*/
sz = 0;
skip = 0;
while (1) {
rsz = strcspn(cp, "\\");
if (rsz) {
cp += rsz;
if (skip) {
skip = 0;
rsz--;
for (cp = buf; *cp != '\0'; cp++)
if (isalnum((unsigned char)*cp) == 0 &&
strchr("!$&'()*+,-./:;=?@_~", *cp) == NULL)
*cp = '_';
if (unique == 0)
return buf;
/* Avoid duplicate HTML id= attributes. */
bufs = NULL;
suffix = 1;
slot = ohash_qlookup(&id_unique, buf);
cp = ohash_find(&id_unique, slot);
if (cp != NULL) {
while (cp != NULL) {
free(bufs);
if (++suffix > 127) {
free(buf);
return NULL;
}
sz += rsz;
}
if ('\0' == *cp)
break;
cp++;
switch (mandoc_escape(&cp, NULL, NULL)) {
case ESCAPE_ERROR:
return sz;
case ESCAPE_UNICODE:
case ESCAPE_NUMBERED:
case ESCAPE_SPECIAL:
case ESCAPE_OVERSTRIKE:
if (skip)
skip = 0;
else
sz++;
break;
case ESCAPE_SKIPCHAR:
skip = 1;
break;
default:
break;
mandoc_asprintf(&bufs, "%s_%d", buf, suffix);
slot = ohash_qlookup(&id_unique, bufs);
cp = ohash_find(&id_unique, slot);
}
free(buf);
buf = bufs;
}
return sz;
ohash_insert(&id_unique, slot, buf);
return buf;
}
static int
@ -490,13 +489,10 @@ struct tag *
print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
{
va_list ap;
struct roffsu mysu, *su;
char numbuf[16];
struct tag *t;
const char *attr;
char *arg1, *arg2;
double v;
int i, have_style, tflags;
int tflags;
tflags = htmltags[tag].flags;
@ -536,17 +532,12 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
va_start(ap, fmt);
have_style = 0;
while (*fmt != '\0') {
if (*fmt == 's') {
have_style = 1;
fmt++;
break;
}
/* Parse a non-style attribute and its arguments. */
/* Parse attributes and arguments. */
arg1 = va_arg(ap, char *);
arg2 = NULL;
switch (*fmt++) {
case 'c':
attr = "class";
@ -557,6 +548,10 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
case 'i':
attr = "id";
break;
case 's':
attr = "style";
arg2 = va_arg(ap, char *);
break;
case '?':
attr = arg1;
arg1 = va_arg(ap, char *);
@ -564,13 +559,12 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
default:
abort();
}
arg2 = NULL;
if (*fmt == 'M')
arg2 = va_arg(ap, char *);
if (arg1 == NULL)
continue;
/* Print the non-style attributes. */
/* Print the attributes. */
print_byte(h, ' ');
print_word(h, attr);
@ -597,114 +591,19 @@ print_otag(struct html *h, enum htmltag tag, const char *fmt, ...)
fmt++;
break;
default:
print_encode(h, arg1, NULL, 1);
if (arg2 == NULL)
print_encode(h, arg1, NULL, 1);
else {
print_word(h, arg1);
print_byte(h, ':');
print_byte(h, ' ');
print_word(h, arg2);
print_byte(h, ';');
}
break;
}
print_byte(h, '"');
}
/* Print out styles. */
while (*fmt != '\0') {
arg1 = NULL;
su = NULL;
/* First letter: input argument type. */
switch (*fmt++) {
case 'h':
i = va_arg(ap, int);
su = &mysu;
SCALE_HS_INIT(su, i);
break;
case 's':
arg1 = va_arg(ap, char *);
break;
case 'u':
su = va_arg(ap, struct roffsu *);
break;
case 'w':
if ((arg2 = va_arg(ap, char *)) != NULL) {
su = &mysu;
a2width(arg2, su);
}
if (*fmt == '*') {
if (su != NULL && su->unit == SCALE_EN &&
su->scale > 5.9 && su->scale < 6.1)
su = NULL;
fmt++;
}
if (*fmt == '+') {
if (su != NULL) {
/* Make even bold text fit. */
su->scale *= 1.2;
/* Add padding. */
su->scale += 3.0;
}
fmt++;
}
if (*fmt == '-') {
if (su != NULL)
su->scale *= -1.0;
fmt++;
}
break;
default:
abort();
}
/* Second letter: style name. */
switch (*fmt++) {
case 'h':
attr = "height";
break;
case 'i':
attr = "text-indent";
break;
case 'l':
attr = "margin-left";
break;
case 'w':
attr = "width";
break;
case 'W':
attr = "min-width";
break;
case '?':
attr = arg1;
arg1 = va_arg(ap, char *);
break;
default:
abort();
}
if (su == NULL && arg1 == NULL)
continue;
if (have_style == 1)
print_word(h, " style=\"");
else
print_byte(h, ' ');
print_word(h, attr);
print_byte(h, ':');
print_byte(h, ' ');
if (su != NULL) {
v = su->scale;
if (su->unit == SCALE_MM && (v /= 100.0) == 0.0)
v = 1.0;
else if (su->unit == SCALE_BU)
v /= 24.0;
(void)snprintf(numbuf, sizeof(numbuf), "%.2f", v);
print_word(h, numbuf);
print_word(h, roffscales[su->unit]);
} else
print_word(h, arg1);
print_byte(h, ';');
have_style = 2;
}
if (have_style == 2)
print_byte(h, '"');
va_end(ap);
/* Accommodate for "well-formed" singleton escaping. */
@ -768,6 +667,32 @@ print_gen_decls(struct html *h)
print_endline(h);
}
void
print_gen_comment(struct html *h, struct roff_node *n)
{
int wantblank;
print_word(h, "<!-- This is an automatically generated file."
" Do not edit.");
h->indent = 1;
wantblank = 0;
while (n != NULL && n->type == ROFFT_COMMENT) {
if (strstr(n->string, "-->") == NULL &&
(wantblank || *n->string != '\0')) {
print_endline(h);
print_indent(h);
print_word(h, n->string);
wantblank = *n->string != '\0';
}
n = n->next;
}
if (wantblank)
print_endline(h);
print_word(h, " -->");
print_endline(h);
h->indent = 0;
}
void
print_text(struct html *h, const char *word)
{
@ -959,21 +884,3 @@ print_word(struct html *h, const char *cp)
while (*cp != '\0')
print_byte(h, *cp++);
}
/*
* Calculate the scaling unit passed in a `-width' argument. This uses
* either a native scaling unit (e.g., 1i, 2m) or the string length of
* the value.
*/
static void
a2width(const char *p, struct roffsu *su)
{
const char *end;
end = a2roffsu(p, su, SCALE_MAX);
if (end == NULL || *end != '\0') {
su->unit = SCALE_EN;
su->scale = html_strlen(p);
} else if (su->scale < 0.0)
su->scale = 0.0;
}

View File

@ -1,7 +1,7 @@
/* $Id: html.h,v 1.87 2017/07/08 14:51:04 schwarze Exp $ */
/* $Id: html.h,v 1.92 2018/06/25 16:54:59 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -23,6 +23,7 @@ enum htmltag {
TAG_META,
TAG_TITLE,
TAG_DIV,
TAG_IDIV,
TAG_H1,
TAG_H2,
TAG_SPAN,
@ -30,8 +31,6 @@ enum htmltag {
TAG_BR,
TAG_A,
TAG_TABLE,
TAG_COLGROUP,
TAG_COL,
TAG_TR,
TAG_TD,
TAG_LI,
@ -119,6 +118,7 @@ struct eqn_box;
void roff_html_pre(struct html *, const struct roff_node *);
void print_gen_comment(struct html *, struct roff_node *);
void print_gen_decls(struct html *);
void print_gen_head(struct html *);
struct tag *print_otag(struct html *, enum htmltag, const char *, ...);
@ -131,5 +131,4 @@ void print_eqn(struct html *, const struct eqn_box *);
void print_paragraph(struct html *);
void print_endline(struct html *);
char *html_make_id(const struct roff_node *);
int html_strlen(const char *);
char *html_make_id(const struct roff_node *, int);

View File

@ -1,4 +1,4 @@
/* $Id: lib.in,v 1.19 2016/11/23 20:22:13 schwarze Exp $ */
/* $Id: lib.in,v 1.20 2017/08/20 02:30:27 schwarze Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2009, 2012 Joerg Sonnenberger <joerg@netbsd.org>
@ -25,11 +25,13 @@
*/
LINE("lib80211", "802.11 Wireless Network Management Library (lib80211, \\-l80211)")
LINE("libalias", "Packet Aliasing Library (libalias, \\-lalias)")
LINE("libarchive", "Streaming Archive Library (libarchive, \\-larchive)")
LINE("libarm", "ARM Architecture Library (libarm, \\-larm)")
LINE("libarm32", "ARM32 Architecture Library (libarm32, \\-larm32)")
LINE("libbe", "Boot Environment Library (libbe, \\-lbe)")
LINE("libbluetooth", "Bluetooth Library (libbluetooth, \\-lbluetooth)")
LINE("libbsdxml", "eXpat XML parser library (libbsdxml, \\-lbsdxml)")
LINE("libbsm", "Basic Security Module Library (libbsm, \\-lbsm)")
LINE("libc", "Standard C\\~Library (libc, \\-lc)")
LINE("libc_r", "Reentrant C\\~Library (libc_r, \\-lc_r)")
@ -115,6 +117,7 @@ LINE("libsbuf", "Safe String Composition Library (libsbuf, \\-lsbuf)")
LINE("libsdp", "Bluetooth Service Discovery Protocol User Library (libsdp, \\-lsdp)")
LINE("libssp", "Buffer Overflow Protection Library (libssp, \\-lssp)")
LINE("libstdthreads", "C11 Threads Library (libstdthreads, \\-lstdthreads)")
LINE("libstdthreads", "C11 Threads Library (libstdthreads, \\-lstdthreads)")
LINE("libSystem", "System Library (libSystem, \\-lSystem)")
LINE("libsysdecode", "System Argument Decoding Library (libsysdecode, \\-lsysdecode)")
LINE("libtacplus", "TACACS+ Client Library (libtacplus, \\-ltacplus)")

View File

@ -1,4 +1,4 @@
/* $Id: libmandoc.h,v 1.70 2017/07/08 17:52:49 schwarze Exp $ */
/* $Id: libmandoc.h,v 1.71 2018/04/09 22:27:04 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@ -66,7 +66,7 @@ void roff_man_reset(struct roff_man *);
enum rofferr roff_parseln(struct roff *, int, struct buf *, int *);
void roff_endparse(struct roff *);
void roff_setreg(struct roff *, const char *, int, char sign);
int roff_getreg(const struct roff *, const char *);
int roff_getreg(struct roff *, const char *);
char *roff_strdup(const struct roff *, const char *);
int roff_getcontrol(const struct roff *,
const char *, int *);

View File

@ -1,7 +1,7 @@
/* $Id: main.c,v 1.301 2017/07/26 10:21:55 schwarze Exp $ */
/* $Id: main.c,v 1.306 2018/05/14 14:10:23 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010-2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010 Joerg Sonnenberger <joerg@netbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
@ -19,6 +19,7 @@
#include "config.h"
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/param.h> /* MACHINE */
#include <sys/wait.h>
@ -38,6 +39,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
@ -120,6 +122,7 @@ main(int argc, char *argv[])
struct manconf conf;
struct mansearch search;
struct curparse curp;
struct winsize ws;
struct tag_files *tag_files;
struct manpage *res, *resp;
const char *progname, *sec, *thisarg;
@ -129,7 +132,7 @@ main(int argc, char *argv[])
size_t i, sz;
int prio, best_prio;
enum outmode outmode;
int fd;
int fd, startdir;
int show_usage;
int options;
int use_pager;
@ -316,6 +319,16 @@ main(int argc, char *argv[])
!isatty(STDOUT_FILENO))
use_pager = 0;
if (use_pager &&
(conf.output.width == 0 || conf.output.indent == 0) &&
ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 &&
ws.ws_col > 1) {
if (conf.output.width == 0 && ws.ws_col < 79)
conf.output.width = ws.ws_col - 1;
if (conf.output.indent == 0 && ws.ws_col < 66)
conf.output.indent = 3;
}
#if HAVE_PLEDGE
if (!use_pager)
if (pledge("stdio rpath", NULL) == -1)
@ -374,15 +387,34 @@ main(int argc, char *argv[])
argc, argv, &res, &sz))
usage(search.argmode);
if (sz == 0) {
if (search.argmode == ARG_NAME)
fs_search(&search, &conf.manpath,
argc, argv, &res, &sz);
else
warnx("nothing appropriate");
if (sz == 0 && search.argmode == ARG_NAME)
fs_search(&search, &conf.manpath,
argc, argv, &res, &sz);
if (search.argmode == ARG_NAME) {
for (c = 0; c < argc; c++) {
if (strchr(argv[c], '/') == NULL)
continue;
if (access(argv[c], R_OK) == -1) {
warn("%s", argv[c]);
continue;
}
res = mandoc_reallocarray(res,
sz + 1, sizeof(*res));
res[sz].file = mandoc_strdup(argv[c]);
res[sz].names = NULL;
res[sz].output = NULL;
res[sz].ipath = SIZE_MAX;
res[sz].bits = 0;
res[sz].sec = 10;
res[sz].form = FORM_SRC;
sz++;
}
}
if (sz == 0) {
if (search.argmode != ARG_NAME)
warnx("nothing appropriate");
rc = MANDOCLEVEL_BADARG;
goto out;
}
@ -466,7 +498,29 @@ main(int argc, char *argv[])
parse(&curp, STDIN_FILENO, "<stdin>");
}
/*
* Remember the original working directory, if possible.
* This will be needed if some names on the command line
* are page names and some are relative file names.
* Do not error out if the current directory is not
* readable: Maybe it won't be needed after all.
*/
startdir = open(".", O_RDONLY | O_DIRECTORY);
while (argc > 0) {
/*
* Changing directories is not needed in ARG_FILE mode.
* Do it on a best-effort basis. Even in case of
* failure, some functionality may still work.
*/
if (resp != NULL) {
if (resp->ipath != SIZE_MAX)
(void)chdir(conf.manpath.paths[resp->ipath]);
else if (startdir != -1)
(void)fchdir(startdir);
}
fd = mparse_open(curp.mp, resp != NULL ? resp->file : *argv);
if (fd != -1) {
if (use_pager) {
@ -476,14 +530,23 @@ main(int argc, char *argv[])
if (resp == NULL)
parse(&curp, fd, *argv);
else if (resp->form == FORM_SRC) {
/* For .so only; ignore failure. */
(void)chdir(conf.manpath.paths[resp->ipath]);
else if (resp->form == FORM_SRC)
parse(&curp, fd, resp->file);
} else
else
passthrough(resp->file, fd,
conf.output.synopsisonly);
if (ferror(stdout)) {
if (tag_files != NULL) {
warn("%s", tag_files->ofn);
tag_unlink();
tag_files = NULL;
} else
warn("stdout");
rc = MANDOCLEVEL_SYSERR;
break;
}
if (argc > 1 && curp.outtype <= OUTT_UTF8) {
if (curp.outdata == NULL)
outdata_alloc(&curp);
@ -502,6 +565,10 @@ main(int argc, char *argv[])
if (--argc)
mparse_reset(curp.mp);
}
if (startdir != -1) {
(void)fchdir(startdir);
close(startdir);
}
if (curp.outdata != NULL) {
switch (curp.outtype) {
@ -722,7 +789,8 @@ fs_search(const struct mansearch *cfg, const struct manpaths *paths,
cfg->firstmatch)
return 1;
}
if (res != NULL && *ressz == lastsz)
if (res != NULL && *ressz == lastsz &&
strchr(*argv, '/') == NULL)
warnx("No entry for %s in the manual.", *argv);
lastsz = *ressz;
argv++;
@ -1173,7 +1241,7 @@ spawn_pager(struct tag_files *tag_files)
if (dup2(tag_files->ofd, STDOUT_FILENO) == -1)
err((int)MANDOCLEVEL_SYSERR, "pager stdout");
close(tag_files->ofd);
close(tag_files->tfd);
assert(tag_files->tfd == -1);
/* Do not start the pager before controlling the terminal. */

View File

@ -1,4 +1,4 @@
.\" $Id: man.1,v 1.29 2017/05/17 23:23:00 schwarze Exp $
.\" $Id: man.1,v 1.33 2018/04/19 23:41:16 schwarze Exp $
.\"
.\" Copyright (c) 1989, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -31,7 +31,7 @@
.\"
.\" @(#)man.1 8.2 (Berkeley) 1/2/94
.\"
.Dd $Mdocdate: August 8 2018 $
.Dd $Mdocdate: April 19 2018 $
.Dt MAN 1
.Os
.Sh NAME
@ -75,9 +75,21 @@ See
for a description of the contents of this file.
.It Fl c
Copy the manual page to the standard output instead of using
.Xr less 1
.Xr more 1
to paginate it.
This is done by default if the standard output is not a terminal device.
.Pp
When using
.Fl c ,
most terminal devices are unable to show the markup.
To print the output of
.Nm
to the terminal with markup but without using a pager, pipe it to
.Xr ul 1 .
To remove the markup, pipe the output to
.Xr col 1
.Fl b
instead.
.It Fl f
A synonym for
.Xr whatis 1 .
@ -102,8 +114,7 @@ manual.
By default, it displays the header lines of all matching pages.
.It Fl l
A synonym for
.Xr mandoc 1
.Fl a .
.Xr mandoc 1 .
The
.Ar name
arguments are interpreted as filenames.
@ -115,6 +126,8 @@ No search is done and
and
.Fl w
are ignored.
This option implies
.Fl a .
.It Fl M Ar path
Override the list of standard directories which
.Nm
@ -233,7 +246,7 @@ is case insensitive.
Any non-empty value of the environment variable
.Ev MANPAGER
is used instead of the standard pagination program,
.Xr less 1 .
.Xr more 1 .
If
.Xr less 1
is used, the interactive
@ -282,14 +295,9 @@ Specifies the pagination program to use when
.Ev MANPAGER
is not defined.
If neither PAGER nor MANPAGER is defined,
.Xr less 1
.Xr more 1
.Fl s
is used.
Only used if
.Fl a
or
.Fl l
is specified.
.El
.Sh FILES
.Bl -tag -width /etc/man.conf -compact
@ -301,20 +309,24 @@ default man configuration file
See
.Xr mandoc 1
for details.
.Sh EXAMPLES
Format a page for pasting extracts into an email message \(em
avoid printing any UTF-8 characters, reduce the width to ease
quoting in replies, and remove markup:
.Pp
.Dl $ man -T ascii -O width=65 pledge | col -b
.Pp
Read a typeset page in a PDF viewer:
.Pp
.Dl $ MANPAGER=mupdf man -T pdf lpd
.Sh SEE ALSO
.Xr apropos 1 ,
.Xr intro 1 ,
.Xr col 1 ,
.Xr mandoc 1 ,
.Xr ul 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
.Xr mdoc 7
.Sh STANDARDS
The
.Nm

View File

@ -1,4 +1,4 @@
.\" $Id: man.7,v 1.136 2017/06/25 11:42:02 schwarze Exp $
.\" $Id: man.7,v 1.137 2018/04/05 22:12:33 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: June 25 2017 $
.Dd $Mdocdate: April 5 2018 $
.Dt MAN 7
.Os
.Sh NAME
@ -273,7 +273,6 @@ in the alphabetical reference below.
.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
@ -297,9 +296,7 @@ The optional arguments specify which release it is from.
Text is rendered in bold face.
.Pp
See also
.Sx \&I
and
.Sx \&R .
.Sx \&I .
.Ss \&BI
Text is rendered alternately in bold face and italic.
Thus,
@ -393,9 +390,7 @@ and
Text is rendered in italics.
.Pp
See also
.Sx \&B
and
.Sx \&R .
.Sx \&B .
.Ss \&IB
Text is rendered alternately in italics and bold face.
Whitespace between arguments is omitted in output.
@ -546,13 +541,6 @@ See also
.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.
@ -790,7 +778,6 @@ The syntax is as follows:
.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 \&

View File

@ -1,4 +1,4 @@
.\" $Id: man.cgi.8,v 1.22 2017/03/18 16:48:24 schwarze Exp $
.\" $Id: man.cgi.8,v 1.23 2018/05/20 21:48:44 schwarze Exp $
.\"
.\" Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
.\"
@ -14,7 +14,7 @@
.\" 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 18 2017 $
.Dd $Mdocdate: May 20 2018 $
.Dt MAN.CGI 8
.Os
.Sh NAME
@ -104,6 +104,9 @@ Lists are returned when searches match more than one manual page.
The first column shows the names and section numbers of manuals
as clickable links.
The second column shows the one-line descriptions of the manuals.
For
.Xr man 1
style searches, the content of the first manual page follows the list.
.It A manual page.
This output format is used when a search matches exactly one
manual page, or when a link on a list page or an
@ -111,7 +114,7 @@ manual page, or when a link on a list page or an
link on another manual page is followed.
.It A no-result page.
This is shown when a search request returns no results -
eiher because it violates the query syntax, or because
either because it violates the query syntax, or because
the search does not match any manual pages.
.It \&An error page.
This cannot happen by merely clicking the
@ -234,6 +237,8 @@ They consist of:
.It
The
.Cm http://
or
.Cm https://
protocol specifier.
.It
The host name.
@ -394,7 +399,7 @@ The
CGI program is call-compatible with queries from the traditional
.Pa man.cgi
script by Wolfram Schneider.
However, the output may not be quite the same.
However, the output looks quite different.
.Sh SEE ALSO
.Xr apropos 1 ,
.Xr mandoc.db 5 ,

View File

@ -1,4 +1,4 @@
.\" $Id: man.conf.5,v 1.4 2016/12/28 22:52:17 schwarze Exp $
.\" $Id: man.conf.5,v 1.5 2017/08/22 18:17:52 schwarze Exp $
.\"
.\" Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: December 28 2016 $
.Dd $Mdocdate: August 22 2017 $
.Dt MAN.CONF 5
.Os
.Sh NAME
@ -74,8 +74,12 @@ 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 .
to work, and also for
.Xr man 1
on operating systems like
.Ox
that install each manual page with only one file name in the file system,
even if it documents multiple utilities or functions.
.It Ic output Ar option Op Ar value
Configure the default value of an output option.
These directives are overridden by the

View File

@ -1,7 +1,7 @@
/* $Id: man_html.c,v 1.145 2017/06/25 11:42:02 schwarze Exp $ */
/* $Id: man_html.c,v 1.153 2018/07/27 17:49:31 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -35,8 +35,6 @@
/* FIXME: have PD set the default vspace width. */
#define INDENT 5
#define MAN_ARGS const struct roff_meta *man, \
const struct roff_node *n, \
struct html *h
@ -48,12 +46,11 @@ struct htmlman {
static void print_bvspace(struct html *,
const struct roff_node *);
static void print_man_head(MAN_ARGS);
static void print_man_head(const struct roff_meta *,
struct html *);
static void print_man_nodelist(MAN_ARGS);
static void print_man_node(MAN_ARGS);
static int fillmode(struct html *, int);
static int a2width(const struct roff_node *,
struct roffsu *);
static int man_B_pre(MAN_ARGS);
static int man_HP_pre(MAN_ARGS);
static int man_IP_pre(MAN_ARGS);
@ -68,8 +65,10 @@ static int man_UR_pre(MAN_ARGS);
static int man_alt_pre(MAN_ARGS);
static int man_ign_pre(MAN_ARGS);
static int man_in_pre(MAN_ARGS);
static void man_root_post(MAN_ARGS);
static void man_root_pre(MAN_ARGS);
static void man_root_post(const struct roff_meta *,
struct html *);
static void man_root_pre(const struct roff_meta *,
struct html *);
static const struct htmlman __mans[MAN_MAX - MAN_TH] = {
{ NULL, NULL }, /* TH */
@ -138,30 +137,34 @@ print_bvspace(struct html *h, const struct roff_node *n)
void
html_man(void *arg, const struct roff_man *man)
{
struct html *h;
struct tag *t;
struct html *h;
struct roff_node *n;
struct tag *t;
h = (struct html *)arg;
n = man->first->child;
if ((h->oflags & HTML_FRAGMENT) == 0) {
print_gen_decls(h);
print_otag(h, TAG_HTML, "");
if (n->type == ROFFT_COMMENT)
print_gen_comment(h, n);
t = print_otag(h, TAG_HEAD, "");
print_man_head(&man->meta, man->first, h);
print_man_head(&man->meta, h);
print_tagq(h, t);
print_otag(h, TAG_BODY, "");
}
man_root_pre(&man->meta, man->first, h);
man_root_pre(&man->meta, h);
t = print_otag(h, TAG_DIV, "c", "manual-text");
print_man_nodelist(&man->meta, man->first->child, h);
print_man_nodelist(&man->meta, n, h);
print_tagq(h, t);
man_root_post(&man->meta, man->first, h);
man_root_post(&man->meta, h);
print_tagq(h, NULL);
}
static void
print_man_head(MAN_ARGS)
print_man_head(const struct roff_meta *man, struct html *h)
{
char *cp;
@ -262,6 +265,8 @@ print_man_node(MAN_ARGS)
break;
print_paragraph(h);
return;
case ROFFT_COMMENT:
return;
default:
break;
}
@ -359,16 +364,8 @@ fillmode(struct html *h, int want)
return had;
}
static int
a2width(const struct roff_node *n, struct roffsu *su)
{
if (n->type != ROFFT_TEXT)
return 0;
return a2roffsu(n->string, su, SCALE_EN) != NULL;
}
static void
man_root_pre(MAN_ARGS)
man_root_pre(const struct roff_meta *man, struct html *h)
{
struct tag *t, *tt;
char *title;
@ -396,7 +393,7 @@ man_root_pre(MAN_ARGS)
}
static void
man_root_post(MAN_ARGS)
man_root_post(const struct roff_meta *man, struct html *h)
{
struct tag *t, *tt;
@ -419,11 +416,10 @@ man_SH_pre(MAN_ARGS)
char *id;
if (n->type == ROFFT_HEAD) {
id = html_make_id(n);
id = html_make_id(n, 1);
print_otag(h, TAG_H1, "cTi", "Sh", id);
if (id != NULL)
print_otag(h, TAG_A, "chR", "selflink", id);
free(id);
print_otag(h, TAG_A, "chR", "permalink", id);
}
return 1;
}
@ -489,11 +485,10 @@ man_SS_pre(MAN_ARGS)
char *id;
if (n->type == ROFFT_HEAD) {
id = html_make_id(n);
id = html_make_id(n, 1);
print_otag(h, TAG_H2, "cTi", "Ss", id);
if (id != NULL)
print_otag(h, TAG_A, "chR", "selflink", id);
free(id);
print_otag(h, TAG_A, "chR", "permalink", id);
}
return 1;
}
@ -516,7 +511,7 @@ man_IP_pre(MAN_ARGS)
const struct roff_node *nn;
if (n->type == ROFFT_BODY) {
print_otag(h, TAG_DD, "c", "It-tag");
print_otag(h, TAG_DD, "");
return 1;
} else if (n->type != ROFFT_HEAD) {
print_otag(h, TAG_DL, "c", "Bl-tag");
@ -525,7 +520,7 @@ man_IP_pre(MAN_ARGS)
/* FIXME: width specification. */
print_otag(h, TAG_DT, "c", "It-tag");
print_otag(h, TAG_DT, "");
/* For IP, only print the first header element. */
@ -550,24 +545,13 @@ man_IP_pre(MAN_ARGS)
static int
man_HP_pre(MAN_ARGS)
{
struct roffsu sum, sui;
const struct roff_node *np;
if (n->type == ROFFT_HEAD)
return 0;
else if (n->type != ROFFT_BLOCK)
return 1;
np = n->head->child;
if (np == NULL || !a2width(np, &sum))
SCALE_HS_INIT(&sum, INDENT);
sui.unit = sum.unit;
sui.scale = -sum.scale;
print_bvspace(h, n);
print_otag(h, TAG_DIV, "csului", "Pp", &sum, &sui);
if (n->type == ROFFT_BLOCK) {
print_bvspace(h, n);
print_otag(h, TAG_DIV, "c", "HP");
}
return 1;
}
@ -629,18 +613,10 @@ man_ign_pre(MAN_ARGS)
static int
man_RS_pre(MAN_ARGS)
{
struct roffsu su;
if (n->type == ROFFT_HEAD)
return 0;
else if (n->type == ROFFT_BODY)
return 1;
SCALE_HS_INIT(&su, INDENT);
if (n->head->child)
a2width(n->head->child, &su);
print_otag(h, TAG_DIV, "sul", &su);
if (n->type == ROFFT_BLOCK)
print_otag(h, TAG_DIV, "c", "Bd-indent");
return 1;
}

View File

@ -1,7 +1,7 @@
/* $Id: man_term.c,v 1.209 2017/07/31 15:19:06 schwarze Exp $ */
/* $Id: man_term.c,v 1.211 2018/06/10 15:12:35 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -675,7 +675,8 @@ pre_SS(DECL_ARGS)
n = n->prev;
} while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
if (n == NULL || n->type == ROFFT_COMMENT ||
(n->tok == MAN_SS && n->body->child == NULL))
break;
for (i = 0; i < mt->pardist; i++)
@ -737,7 +738,8 @@ pre_SH(DECL_ARGS)
n = n->prev;
} while (n != NULL && n->tok >= MAN_TH &&
termacts[n->tok].flags & MAN_NOTEXT);
if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
if (n == NULL || n->type == ROFFT_COMMENT ||
(n->tok == MAN_SH && n->body->child == NULL))
break;
for (i = 0; i < mt->pardist; i++)
@ -885,7 +887,8 @@ print_man_node(DECL_ARGS)
term_word(p, n->string);
goto out;
case ROFFT_COMMENT:
return;
case ROFFT_EQN:
if ( ! (n->flags & NODE_LINE))
p->flags |= TERMP_NOSPACE;
@ -1029,6 +1032,18 @@ print_man_foot(struct termp *p, const struct roff_meta *meta)
term_word(p, title);
term_flushln(p);
/*
* Reset the terminal state for more output after the footer:
* Some output modes, in particular PostScript and PDF, print
* the header and the footer into a buffer such that it can be
* reused for multiple output pages, then go on to format the
* main text.
*/
p->tcol->offset = 0;
p->flags = 0;
free(title);
}

View File

@ -1,7 +1,7 @@
/* $OpenBSD$ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -120,6 +120,7 @@ man_node_validate(struct roff_man *man)
case ROFFT_ROOT:
check_root(man, n);
break;
case ROFFT_COMMENT:
case ROFFT_EQN:
case ROFFT_TBL:
break;
@ -149,10 +150,9 @@ man_node_validate(struct roff_man *man)
static void
check_root(CHKARGS)
{
assert((man->flags & (MAN_BLINE | MAN_ELINE)) == 0);
if (NULL == man->first->child)
if (n->last == NULL || n->last->type == ROFFT_COMMENT)
mandoc_msg(MANDOCERR_DOC_EMPTY, man->parse,
n->line, n->pos, NULL);
else

View File

@ -1,7 +1,7 @@
.\" $Id: mandoc.1,v 1.217 2017/07/20 15:26:41 schwarze Exp $
.\" $Id: mandoc.1,v 1.226 2018/07/28 18:34:15 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2012, 2014-2017 Ingo Schwarze <schwarze@openbsd.org>
.\" Copyright (c) 2012, 2014-2018 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: August 8 2018 $
.Dd $Mdocdate: July 28 2018 $
.Dt MANDOC 1
.Os
.Sh NAME
@ -34,9 +34,7 @@
.Sh DESCRIPTION
The
.Nm
utility formats
.Ux
manual pages for display.
utility formats manual pages for display.
.Pp
By default,
.Nm
@ -54,13 +52,13 @@ The options are as follows:
If the standard output is a terminal device and
.Fl c
is not specified, use
.Xr less 1
.Xr more 1
to paginate the output, just like
.Xr man 1
would.
.It Fl c
Copy the formatted manual pages to the standard output without using
.Xr less 1
.Xr more 1
to paginate them.
This is the default.
It can be specified to override
@ -118,7 +116,7 @@ With
all input files are interpreted as
.Xr man 7 .
By default, the input language is automatically detected for each file:
if the the first macro is
if the first macro is
.Ic \&Dd
or
.Ic \&Dt ,
@ -132,13 +130,32 @@ With other arguments,
is silently ignored.
.It Fl O Ar options
Comma-separated output options.
See the descriptions of the individual output formats for supported
.Ar options .
.It Fl T Ar output
Output format.
See
.Sx Output Formats
for available formats.
Defaults to
.Fl T Cm locale .
Select the output format.
Supported values for the
.Ar output
argument are
.Cm ascii ,
.Cm html ,
the default of
.Cm locale ,
.Cm man ,
.Cm markdown ,
.Cm pdf ,
.Cm ps ,
.Cm tree ,
and
.Cm utf8 .
.Pp
The special
.Fl T Cm lint
mode only parses the input and produces no output.
It implies
.Fl W Cm all
and redirects parser messages, which usually appear on standard
error output, to standard output.
.It Fl W Ar level
Specify the minimum message
.Ar level
@ -196,11 +213,11 @@ and
are requested, they can be joined with a comma, for example
.Fl W Cm error , Ns Cm stop .
.It Ar file
Read input from zero or more files.
If unspecified, reads from stdin.
If multiple files are specified,
Read from the given input file.
If multiple files are specified, they are processed in the given order.
If unspecified,
.Nm
will halt with the first failed parse.
reads from standard input.
.El
.Pp
The options
@ -220,69 +237,14 @@ manual.
The options
.Fl fkl
are mutually exclusive and override each other.
.Ss Output Formats
The
.Nm
utility accepts the following
.Fl T
arguments, which correspond to output modes:
.Bl -tag -width "-T markdown"
.It Fl T Cm ascii
Produce 7-bit ASCII output.
See
.Sx ASCII Output .
.It Fl T Cm html
Produce HTML5, CSS1, and MathML output.
See
.Sx HTML Output .
.It Fl T Cm lint
Parse only: produce no output.
Implies
.Fl W Cm all
and redirects parser messages, which usually appear
on standard error output, to standard output.
.It Fl T Cm locale
Encode output using the current locale.
This is the default.
See
.Sx Locale Output .
.It Fl T Cm man
Produce
.Xr man 7
format output.
See
.Sx Man Output .
.It Fl T Cm markdown
Produce output in
.Sy markdown
format.
See
.Sx Markdown Output .
.It Fl T Cm pdf
Produce PDF output.
See
.Sx PDF Output .
.It Fl T Cm ps
Produce PostScript output.
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
.Sx UTF\-8 Output .
.El
.Pp
If multiple input files are specified, these will be processed by the
corresponding filter in-order.
.Ss ASCII Output
Output produced by
Use
.Fl T Cm ascii
is rendered in standard 7-bit ASCII documented in
.Xr ascii 7 .
to force text output in 7-bit ASCII character encoding documented in the
.Xr ascii 7
manual page, ignoring the
.Xr locale 1
set in the environment.
.Pp
Font styles are applied by using back-spaced encoding such that an
underlined character
@ -299,9 +261,6 @@ The special characters documented in
.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
exceed this limit.
.Pp
The following
.Fl O
arguments are accepted:
@ -315,9 +274,30 @@ and seven for
.Xr man 7 .
Increasing this is not recommended; it may result in degraded formatting,
for example overfull lines or ugly line breaks.
When output is to a pager on a terminal that is less than 66 columns
wide, the default is reduced to three columns.
.It Cm mdoc
Format
.Xr man 7
input files in
.Xr mdoc 7
output style.
Specifically, this suppresses the two additional blank lines near the
top and the bottom of each page, and it implies
.Fl O Cm indent Ns =5 .
One useful application is for checking that
.Fl T Cm man
output formats in the same way as the
.Xr mdoc 7
source it was generated from.
.It Cm width Ns = Ns Ar width
The output width is set to
.Ar width .
.Ar width
instead of the default of 78.
When output is to a pager on a terminal that is less than 79 columns
wide, the default is reduced to one less than the terminal width.
In any case, lines that are output in literal mode are never wrapped
and may exceed the output width.
.El
.Ss HTML Output
Output produced by
@ -338,7 +318,8 @@ defaults to simple output (via an embedded style-sheet)
readable in any graphical or text-based web
browser.
.Pp
Special characters are rendered in decimal-encoded UTF\-8.
Non-ASCII characters are rendered
as hexadecimal Unicode character references.
.Pp
The following
.Fl O
@ -388,19 +369,28 @@ This must be a valid absolute or
relative URI.
.El
.Ss Locale Output
Locale-depending output encoding is triggered with
By default,
.Nm
automatically selects UTF-8 or ASCII output according to the current
.Xr locale 1 .
If any of the environment variables
.Ev LC_ALL ,
.Ev LC_CTYPE ,
or
.Ev LANG
are set and the first one that is set
selects the UTF-8 character encoding, it produces
.Sx UTF-8 Output ;
otherwise, it falls back to
.Sx ASCII Output .
This output mode can also be selected explicitly 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
Use
.Fl T Cm man
to translate
.Xr mdoc 7
input into
.Xr man 7
output format.
This is useful for distributing manual sources to legacy systems
@ -408,11 +398,7 @@ lacking
.Xr mdoc 7
formatters.
.Pp
If
.Xr mdoc 7
is passed as input, it is translated into
.Xr man 7 .
If the input format is
If the input format of a file is
.Xr man 7 ,
the input is copied to the output, expanding any
.Xr roff 7
@ -424,11 +410,11 @@ level controls which
.Sx DIAGNOSTICS
are displayed before copying the input to the output.
.Ss Markdown Output
Translate
Use
.Fl T Cm markdown
to translate
.Xr mdoc 7
input to the
.Sy markdown
format conforming to
input to the markdown format conforming to
.Lk http://daringfireball.net/projects/markdown/syntax.text\
"John Gruber's 2004 specification" .
The output also almost conforms to the
@ -499,13 +485,24 @@ If an unknown value is encountered,
.Ar letter
is used.
.El
.Ss UTF\-8 Output
.Ss UTF-8 Output
Use
.Fl T Cm utf8
to force a UTF\-8 locale.
to force text output in UTF-8 multi-byte character encoding,
ignoring the
.Xr locale 1
settings in the environment.
See
.Sx Locale Output
for details and options.
.Sx ASCII Output
regarding font styles and
.Fl O
arguments.
.Pp
On operating systems lacking locale or wide character support, and
on those where the internal character representation is not UCS-4,
.Nm
always falls back to
.Sx ASCII Output .
.Ss Syntax tree output
Use
.Fl T Cm tree
@ -574,11 +571,18 @@ Meta data is not available in this case.
.El
.Sh ENVIRONMENT
.Bl -tag -width MANPAGER
.It Ev LC_CTYPE
The character encoding
.Xr locale 1 .
When
.Sx Locale Output
is selected, it decides whether to use ASCII or UTF-8 output format.
It never affects the interpretation of input files.
.It Ev MANPAGER
Any non-empty value of the environment variable
.Ev MANPAGER
is used instead of the standard pagination program,
.Xr less 1 ;
.Xr more 1 ;
see
.Xr man 1
for details.
@ -592,7 +596,7 @@ Specifies the pagination program to use when
.Ev MANPAGER
is not defined.
If neither PAGER nor MANPAGER is defined,
.Xr less 1
.Xr more 1
.Fl s
is used.
Only used if
@ -741,7 +745,7 @@ Please use your good judgement to decide whether any particular
.Cm style
suggestion really justifies a change to the input file.
.It Cm base
A convertion used in the base system of a specific operating system
A convention used in the base system of a specific operating system
is not adhered to.
These are not markup mistakes, and neither the quality of formatting
nor portability are in danger.
@ -849,6 +853,16 @@ Consider using the conventional
date format
.Dq "Month dd, yyyy"
instead.
.It Sy "normalizing date format to" : No ...
.Pq mdoc , man
The
.Ic \&Dd
or
.Ic \&TH
macro provides an abbreviated month name or a day number with a
leading zero.
In the formatted output, the month name is written out in full
and the leading zero is omitted.
.It Sy "lower case character in document title"
.Pq mdoc , man
The title is still used as given in the
@ -861,7 +875,7 @@ A single manual page contains two copies of the RCS identifier for
the same operating system.
Consider deleting the later instance and moving the first one up
to the top of the page.
.It Sy "typo in section name"
.It Sy "possible typo in section name"
.Pq mdoc
Fuzzy string matching revealed that the argument of an
.Ic \&Sh
@ -938,6 +952,12 @@ An
request occurs even though the document already switched to no-fill mode
and did not switch back to fill mode yet.
It has no effect.
.It Sy "verbatim \(dq--\(dq, maybe consider using \e(em"
.Pq mdoc
Even though the ASCII output device renders an em-dash as
.Qq \-\- ,
that is not a good way to write it in an input file
because it renders poorly on all other output devices.
.It Sy "function name without markup"
.Pq mdoc
A word followed by an empty pair of parentheses occurs on a text line.

View File

@ -1,7 +1,7 @@
/* $Id: mandoc.c,v 1.103 2017/07/03 13:40:19 schwarze Exp $ */
/* $Id: mandoc.c,v 1.104 2018/07/28 18:34:15 schwarze Exp $ */
/*
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2011-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -541,6 +541,9 @@ mandoc_normdate(struct roff_man *man, char *in, int ln, int pos)
if (t > time(NULL) + 86400)
mandoc_msg(MANDOCERR_DATE_FUTURE, man->parse,
ln, pos, cp);
else if (*in != '$' && strcmp(in, cp) != 0)
mandoc_msg(MANDOCERR_DATE_NORM, man->parse,
ln, pos, cp);
return cp;
}

253
contrib/mandoc/mandoc.css Normal file
View File

@ -0,0 +1,253 @@
/* $Id: mandoc.css,v 1.36 2018/07/23 22:51:26 schwarze Exp $ */
/*
* Standard style sheet for mandoc(1) -Thtml and man.cgi(8).
*/
/* Global defaults. */
html { max-width: 65em; }
body { font-family: Helvetica,Arial,sans-serif; }
table { margin-top: 0em;
margin-bottom: 0em; }
td { vertical-align: top; }
ul, ol, dl { margin-top: 0em;
margin-bottom: 0em; }
li, dt { margin-top: 1em; }
.permalink { border-bottom: thin dotted;
color: inherit;
font: inherit;
text-decoration: inherit; }
* { clear: both }
/* Search form and search results. */
fieldset { border: thin solid silver;
border-radius: 1em;
text-align: center; }
input[name=expr] {
width: 25%; }
table.results { margin-top: 1em;
margin-left: 2em;
font-size: smaller; }
/* Header and footer lines. */
table.head { width: 100%;
border-bottom: 1px dotted #808080;
margin-bottom: 1em;
font-size: smaller; }
td.head-vol { text-align: center; }
td.head-rtitle {
text-align: right; }
table.foot { width: 100%;
border-top: 1px dotted #808080;
margin-top: 1em;
font-size: smaller; }
td.foot-os { text-align: right; }
/* Sections and paragraphs. */
.manual-text {
margin-left: 3.8em; }
.Nd { display: inline; }
.Sh { margin-top: 1.2em;
margin-bottom: 0.6em;
margin-left: -3.2em;
font-size: 110%; }
.Ss { margin-top: 1.2em;
margin-bottom: 0.6em;
margin-left: -1.2em;
font-size: 105%; }
.Pp { margin: 0.6em 0em; }
.Sx { }
.Xr { }
/* Displays and lists. */
.Bd { }
.Bd-indent { margin-left: 3.8em; }
.Bl-bullet { list-style-type: disc;
padding-left: 1em; }
.Bl-bullet > li { }
.Bl-dash { list-style-type: none;
padding-left: 0em; }
.Bl-dash > li:before {
content: "\2014 "; }
.Bl-item { list-style-type: none;
padding-left: 0em; }
.Bl-item > li { }
.Bl-compact > li {
margin-top: 0em; }
.Bl-enum { padding-left: 2em; }
.Bl-enum > li { }
.Bl-compact > li {
margin-top: 0em; }
.Bl-diag { }
.Bl-diag > dt {
font-style: normal;
font-weight: bold; }
.Bl-diag > dd {
margin-left: 0em; }
.Bl-hang { }
.Bl-hang > dt { }
.Bl-hang > dd {
margin-left: 5.5em; }
.Bl-inset { }
.Bl-inset > dt { }
.Bl-inset > dd {
margin-left: 0em; }
.Bl-ohang { }
.Bl-ohang > dt { }
.Bl-ohang > dd {
margin-left: 0em; }
.Bl-tag { margin-left: 5.5em; }
.Bl-tag > dt {
float: left;
margin-top: 0em;
margin-left: -5.5em;
padding-right: 1.2em;
vertical-align: top; }
.Bl-tag > dd {
clear: right;
width: 100%;
margin-top: 0em;
margin-left: 0em;
vertical-align: top;
overflow: auto; }
.Bl-compact > dt {
margin-top: 0em; }
.Bl-column { }
.Bl-column > tbody > tr { }
.Bl-column > tbody > tr > td {
margin-top: 1em; }
.Bl-compact > tbody > tr > td {
margin-top: 0em; }
.Rs { font-style: normal;
font-weight: normal; }
.RsA { }
.RsB { font-style: italic;
font-weight: normal; }
.RsC { }
.RsD { }
.RsI { font-style: italic;
font-weight: normal; }
.RsJ { font-style: italic;
font-weight: normal; }
.RsN { }
.RsO { }
.RsP { }
.RsQ { }
.RsR { }
.RsT { text-decoration: underline; }
.RsU { }
.RsV { }
.eqn { }
.tbl { }
.HP { margin-left: 3.8em;
text-indent: -3.8em; }
/* Semantic markup for command line utilities. */
table.Nm { }
code.Nm { font-style: normal;
font-weight: bold;
font-family: inherit; }
.Fl { font-style: normal;
font-weight: bold;
font-family: inherit; }
.Cm { font-style: normal;
font-weight: bold;
font-family: inherit; }
.Ar { font-style: italic;
font-weight: normal; }
.Op { display: inline; }
.Ic { font-style: normal;
font-weight: bold;
font-family: inherit; }
.Ev { font-style: normal;
font-weight: normal;
font-family: monospace; }
.Pa { font-style: italic;
font-weight: normal; }
/* Semantic markup for function libraries. */
.Lb { }
code.In { font-style: normal;
font-weight: bold;
font-family: inherit; }
a.In { }
.Fd { font-style: normal;
font-weight: bold;
font-family: inherit; }
.Ft { font-style: italic;
font-weight: normal; }
.Fn { font-style: normal;
font-weight: bold;
font-family: inherit; }
.Fa { font-style: italic;
font-weight: normal; }
.Vt { font-style: italic;
font-weight: normal; }
.Va { font-style: italic;
font-weight: normal; }
.Dv { font-style: normal;
font-weight: normal;
font-family: monospace; }
.Er { font-style: normal;
font-weight: normal;
font-family: monospace; }
/* Various semantic markup. */
.An { }
.Lk { }
.Mt { }
.Cd { font-style: normal;
font-weight: bold;
font-family: inherit; }
.Ad { font-style: italic;
font-weight: normal; }
.Ms { font-style: normal;
font-weight: bold; }
.St { }
.Ux { }
/* Physical markup. */
.Bf { display: inline; }
.No { font-style: normal;
font-weight: normal; }
.Em { font-style: italic;
font-weight: normal; }
.Sy { font-style: normal;
font-weight: bold; }
.Li { font-style: normal;
font-weight: normal;
font-family: monospace; }
/* Overrides to avoid excessive margins on small devices. */
@media (max-width: 37.5em) {
.manual-text {
margin-left: 0.5em; }
.Sh, .Ss { margin-left: 0em; }
.Bd-indent { margin-left: 2em; }
.Bl-hang > dd {
margin-left: 2em; }
.Bl-tag { margin-left: 2em; }
.Bl-tag > dt {
margin-left: -2em; }
.HP { margin-left: 2em;
text-indent: -2em; }
}

View File

@ -1,7 +1,7 @@
/* $Id: mandoc.h,v 1.245 2017/07/08 14:51:04 schwarze Exp $ */
/* $Id: mandoc.h,v 1.248 2018/07/28 18:34:15 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2017 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -56,9 +56,10 @@ enum mandocerr {
MANDOCERR_STYLE, /* ===== start of style suggestions ===== */
MANDOCERR_DATE_LEGACY, /* legacy man(7) date format: Dd ... */
MANDOCERR_DATE_NORM, /* normalizing date format to: ... */
MANDOCERR_TITLE_CASE, /* lower case character in document title */
MANDOCERR_RCS_REP, /* duplicate RCS id: ... */
MANDOCERR_SEC_TYPO, /* typo in section name: Sh ... */
MANDOCERR_SEC_TYPO, /* possible typo in section name: Sh ... */
MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */
MANDOCERR_MACRO_USELESS, /* useless macro: macro */
MANDOCERR_BX, /* consider using OS macro: macro */
@ -68,6 +69,7 @@ enum mandocerr {
MANDOCERR_DELIM_NB, /* no blank before trailing delimiter: macro ... */
MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping: fi */
MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping: nf */
MANDOCERR_DASHDASH, /* verbatim "--", maybe consider using \(em */
MANDOCERR_FUNC, /* function name without markup: name() */
MANDOCERR_SPACE_EOL, /* whitespace at end of input line */
MANDOCERR_COMMENT_BAD, /* bad comment style */

View File

@ -1,4 +1,4 @@
/* $Id: mandoc_aux.c,v 1.10 2017/06/12 19:05:47 schwarze Exp $ */
/* $Id: mandoc_aux.c,v 1.11 2018/02/07 20:04:57 schwarze Exp $ */
/*
* Copyright (c) 2009, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@ -111,8 +111,8 @@ mandoc_strndup(const char *ptr, size_t sz)
{
char *p;
p = mandoc_malloc(sz + 1);
memcpy(p, ptr, sz);
p[(int)sz] = '\0';
p = strndup(ptr, sz);
if (p == NULL)
err((int)MANDOCLEVEL_SYSERR, NULL);
return p;
}

View File

@ -1,4 +1,4 @@
.\" $Id: mandoc_char.7,v 1.67 2017/06/14 20:57:07 schwarze Exp $
.\" $Id: mandoc_char.7,v 1.72 2018/08/08 14:30:48 schwarze Exp $
.\"
.\" Copyright (c) 2003 Jason McIntyre <jmc@openbsd.org>
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: June 14 2017 $
.Dd $Mdocdate: August 8 2018 $
.Dt MANDOC_CHAR 7
.Os
.Sh NAME
@ -35,23 +35,37 @@ documents.
.Pp
The rendering depends on the
.Xr mandoc 1
output mode; in ASCII output, most characters are completely
unintelligible.
For that reason, using any of the special characters documented here,
except those discussed in the
output mode; it can be inspected by calling
.Xr man 1
on the
.Nm
manual page with different
.Fl T
arguments.
In ASCII output, the rendering of some characters may be hard
to interpret for the reader.
Many are rendered as descriptive strings like
.Qq <integral> ,
.Qq <degree> ,
or
.Qq <Gamma> ,
which may look ugly, and many are replaced by similar ASCII characters.
In particular, accented characters are usually shown without the accent.
For that reason, try to avoid using any of the special characters
documented here except those discussed in the
.Sx DESCRIPTION ,
is strongly discouraged; they are supported merely for backwards
compatibility with existing documents.
unless they are essential for explaining the subject matter at hand,
for example when documenting complicated mathematical functions.
.Pp
In particular, in English manual pages, do not use special-character
escape sequences to represent national language characters in author
names; instead, provide ASCII transcriptions of the names.
.Ss Dashes and Hyphens
In typography there are different types of dashes of various width:
the hyphen (-),
the minus sign (\(mi),
the hyphen (\(hy),
the en-dash (\(en),
and the em-dash (\(em).
the em-dash (\(em),
and the mathematical minus sign (\(mi).
.Pp
Hyphens are used for adjectives;
to separate the two parts of a compound word;
@ -62,6 +76,42 @@ blue-eyed
lorry-driver
.Ed
.Pp
The en-dash is used to separate the two elements of a range,
or can be used the same way as an em-dash.
It should be written as
.Sq \e(en :
.Bd -unfilled -offset indent
pp. 95\e(en97.
Go away \e(en or else!
.Ed
.Pp
The em-dash can be used to show an interruption
or can be used the same way as colons, semi-colons, or parentheses.
It should be written as
.Sq \e(em :
.Bd -unfilled -offset indent
Three things \e(em apples, oranges, and bananas.
This is not that \e(em rather, this is that.
.Ed
.Pp
In
.Xr roff 7
documents, the minus sign is normally written as
.Sq \e- .
In manual pages, some style guides recommend to also use
.Sq \e-
if an ASCII 0x2d
.Dq hyphen-minus
output glyph that can be copied and pasted is desired in output modes
supporting it, for example in
.Fl T Cm utf8
and
.Fl T Cm html .
But currently, no practically relevant manual page formatter actually
requires that subtlety, so in manual pages just write plain
.Sq -
to represent hyphen, minus, and hyphen-minus.
.Pp
If a word on a text input line contains a hyphen, a formatter may decide
to insert an output line break after the hyphen if that helps filling
the current output line, but the whole word would overflow the line.
@ -85,37 +135,6 @@ Such automatic hyphenation is not supported by
.Xr mandoc 1 ,
which only breaks the line at whitespace, and inside words only
after existing hyphens.
.Pp
The mathematical minus sign is used for negative numbers or subtraction.
It should be written as
.Sq \e(mi :
.Bd -unfilled -offset indent
a = 3 \e(mi 1;
b = \e(mi2;
.Ed
.Pp
The en-dash is used to separate the two elements of a range,
or can be used the same way as an em-dash.
It should be written as
.Sq \e(en :
.Bd -unfilled -offset indent
pp. 95\e(en97.
Go away \e(en or else!
.Ed
.Pp
The em-dash can be used to show an interruption
or can be used the same way as colons, semi-colons, or parentheses.
It should be written as
.Sq \e(em :
.Bd -unfilled -offset indent
Three things \e(em apples, oranges, and bananas.
This is not that \e(em rather, this is that.
.Ed
.Pp
Note:
hyphens, minus signs, and en-dashes look identical under normal ASCII output.
Other formats, such as PostScript, render them correctly,
with differing widths.
.Ss Spaces
To separate words in normal text, for indenting and alignment
in literal context, and when none of the following special cases apply,
@ -319,8 +338,8 @@ Quotes:
.It \e(rq Ta \(rq Ta right double-quote
.It \e(oq Ta \(oq Ta left single-quote
.It \e(cq Ta \(cq Ta right single-quote
.It \e(aq Ta \(aq Ta apostrophe quote (text)
.It \e(dq Ta \(dq Ta double quote (text)
.It \e(aq Ta \(aq Ta apostrophe quote (ASCII character)
.It \e(dq Ta \(dq Ta double quote (ASCII character)
.It \e(Fo Ta \(Fo Ta left guillemet
.It \e(Fc Ta \(Fc Ta right guillemet
.It \e(fo Ta \(fo Ta left single guillemet
@ -336,7 +355,7 @@ Brackets:
.It \e(rC Ta \(rC Ta right brace
.It \e(la Ta \(la Ta left angle
.It \e(ra Ta \(ra Ta right angle
.It \e(bv Ta \(bv Ta brace extension
.It \e(bv Ta \(bv Ta brace extension (special font)
.It \e[braceex] Ta \[braceex] Ta brace extension
.It \e[bracketlefttp] Ta \[bracketlefttp] Ta top-left hooked bracket
.It \e[bracketleftbt] Ta \[bracketleftbt] Ta bottom-left hooked bracket
@ -389,8 +408,8 @@ Logical:
.It Em Input Ta Em Rendered Ta Em Description
.It \e(AN Ta \(AN Ta logical and
.It \e(OR Ta \(OR Ta logical or
.It \e(no Ta \(no Ta logical not
.It \e[tno] Ta \[tno] Ta logical not (text)
.It \e[tno] Ta \[tno] Ta logical not (text font)
.It \e(no Ta \(no Ta logical not (special font)
.It \e(te Ta \(te Ta existential quantifier
.It \e(fa Ta \(fa Ta universal quantifier
.It \e(st Ta \(st Ta such that
@ -402,19 +421,20 @@ Logical:
Mathematical:
.Bl -column "xxcoproductxx" "Rendered" "Description" -offset indent -compact
.It Em Input Ta Em Rendered Ta Em Description
.It \e(pl Ta \(pl Ta plus
.It \e(mi Ta \(mi Ta minus
.It \e- Ta \- Ta minus (text)
.It \e- Ta \- Ta minus (text font)
.It \e(mi Ta \(mi Ta minus (special font)
.It + Ta + Ta plus (text font)
.It \e(pl Ta \(pl Ta plus (special font)
.It \e(-+ Ta \(-+ Ta minus-plus
.It \e(+- Ta \(+- Ta plus-minus
.It \e[t+-] Ta \[t+-] Ta plus-minus (text)
.It \e[t+-] Ta \[t+-] Ta plus-minus (text font)
.It \e(+- Ta \(+- Ta plus-minus (special font)
.It \e(pc Ta \(pc Ta center-dot
.It \e(mu Ta \(mu Ta multiply
.It \e[tmu] Ta \[tmu] Ta multiply (text)
.It \e[tmu] Ta \[tmu] Ta multiply (text font)
.It \e(mu Ta \(mu Ta multiply (special font)
.It \e(c* Ta \(c* Ta circle-multiply
.It \e(c+ Ta \(c+ Ta circle-plus
.It \e(di Ta \(di Ta divide
.It \e[tdi] Ta \[tdi] Ta divide (text)
.It \e[tdi] Ta \[tdi] Ta divide (text font)
.It \e(di Ta \(di Ta divide (special font)
.It \e(f/ Ta \(f/ Ta fraction
.It \e(** Ta \(** Ta asterisk
.It \e(<= Ta \(<= Ta less-than-equal
@ -511,8 +531,8 @@ Accents:
.It \e(ao Ta \(ao Ta ring
.It \e(a\(ti Ta \(a~ Ta tilde
.It \e(ho Ta \(ho Ta ogonek
.It \e(ha Ta \(ha Ta hat (text)
.It \e(ti Ta \(ti Ta tilde (text)
.It \e(ha Ta \(ha Ta hat (ASCII character)
.It \e(ti Ta \(ti Ta tilde (ASCII character)
.El
.Pp
Accented letters:

Some files were not shown because too many files have changed in this diff Show More