summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* new test for an empty text block; from rea@ via bapt@ (FreeBSD)Ingo Schwarze2019-07-183-2/+44
|
* don't print the final heads-up about messagesIngo Schwarze2019-07-151-1/+2
| | | | | when a search did not yield any manual pages to display; issue found with regress/usr.bin/mandoc/db/
* explain escaping of end-of-sentence characters;Ingo Schwarze2019-07-152-0/+13
| | | | missing info reported by Ian <ropers at gmail dot com> on misc@
* If messages are shown and output is printed without a pager, displayIngo Schwarze2019-07-143-1/+13
| | | | | | | | | | a heads-up on stderr at the end because otherwise, users may easily miss the messages: because messages typically occur while parsing, they typically preceed the output. This is most useful with flag combinations like "-c -W all" but may also help in some unusual error scenarios. Inconvenient ordering of output originally pointed out by espie@ for the example situation that /tmp/ is not writeable.
* When parsing a tab character that is not preceded by a space characterIngo Schwarze2019-07-115-6/+8
| | | | | | | | | | | | | | | | on an .It -column line, args() sets the MDOC_PHRASEQL flag to Quote the Last word of the Phrase. Even if it turns out this quoting is not needed because the word is already quoted for other reasons, clear the flag at the end of parsing the phrase, such that the flag does not leak to the next phrase. This patch fixes the bug that the trailing Macro on a line of the form .It "word<tab>word" Ta word Macro<eol> was incorrectly considered quoted and hence not parsed. Bug found by Havard Eidnes (he@) with the NetBSD gettytab(5) manual page: https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54361 Reported via Thomas Klausner (wiz@).
* Some time ago, i simplified mandoc_msg() such that it can be usedIngo Schwarze2019-07-108-241/+338
| | | | | | | | | everywhere and not only in the parsers. For more uniform messages, use it at more places instead of err(3), in particular in the main program. While here, integrate a few trivial functions called at exactly one place into the main option parser, and let a few more functions use the normal convention of returning 0 for success and -1 for error.
* in man.cgi(8), disable -O toc by default; requested by deraadt@Ingo Schwarze2019-07-101-1/+0
|
* The non-standard .EX/.EE macro pair was invented for Version 9 AT&T UNIXIngo Schwarze2019-07-091-4/+8
| | | | | | and only got adopted by GNU two decades later. Thanks to Doug McIlroy <doug at cs dot dartmouth dot edu> for pointing out the error.
* prevent mandoc from segfaulting if /tmp is not writable;Ingo Schwarze2019-07-061-2/+4
| | | | patch from espie@
* use the standard spelling of the word "idiosyncrasy";Ingo Schwarze2019-07-011-1/+1
| | | | suggested by Michal Nowak <mnowak at startmail dot com>
* delete trailing whitespace and space-tab sequences; no code change;Ingo Schwarze2019-07-0110-12/+12
| | | | | patch from Michal Nowak <mnowak at startmail dot com> who found these with git pbchk in the illumos tree
* Fix mandoc_normdate() and the way it is used.Ingo Schwarze2019-06-273-32/+23
| | | | | | | | | | In the past, it could return NULL but the calling code wasn't prepared to handle that. Make sure it always returns an allocated string. While here, simplify the code by handling the "quick" attribute inside mandoc_normdate() rather than at multiple callsites. Triggered by deraadt@ pointing out that snprintf(3) error handling was incomplete in time2a().
* Improve "man -h" output.Ingo Schwarze2019-06-272-20/+29
| | | | | | 1. For pages lacking a SYNOPSIS, show the NAME section rather than nothing. 2. Do not print a stray blank before the beginning of a SYNOPSIS. Both issues reported by, and patch OK'ed by, tb@.
* Do not access a NULL pointer if a table contains a horizontal lineIngo Schwarze2019-06-115-6/+112
| | | | | | next to a table line having fewer columns than the table as a whole. Bug found by Stephen Gregoratto <dev at sgregoratto dot me> with aerc-config(5).
* Explicitly state that the cases in the inner switch in term_fill()Ingo Schwarze2019-06-031-0/+2
| | | | | | | | are exhaustive. While there is no bug, being explicit has no downside is is potentially safer for the future. Michal Nowak <mnowak at startmail dot com> reported that gcc 4.4.4 and 7.4.0 on illumos throw -Wuninitialized false positives.
* Initialize the local variable "lastln" in mparse_buf_r().Ingo Schwarze2019-06-031-1/+1
| | | | | | | | While there is no bug, it logically makes sense given the meaning of the variable that lastln is NULL as long as firstln is NULL. Michal Nowak <mnowak at startmail dot com> reported that gcc 4.4.4 and 7.4.0 on illumos throw -Wuninitialized false positives.
* Initialize the local variable "act" in print_mdoc_node().Ingo Schwarze2019-06-031-0/+1
| | | | | | | | | While there is no bug, it helps clarity, and it is also safer in this particular code because in case a bug gets introduced later, accessing a NULL pointer is less dangerous than accessing an uninitialized pointer. Michal Nowak <mnowak at startmail dot com> reported that gcc 4.4.4 and 7.4.0 on illumos throw -Wuninitialized false positives.
* Support prefers-color-scheme: dark.Ingo Schwarze2019-06-021-7/+20
| | | | | The :visited rule was contributed by <Armin at Besirovic dot com>. Guidance and OK tj@.
* use proper crossreference; patch from naddy@Ingo Schwarze2019-05-261-1/+2
|
* Do not print the style message "missing date" when the date is givenIngo Schwarze2019-05-211-2/+2
| | | | | | as "$Mdocdate$" without an actual date. That is the canonical way to write a new manual page and not bad style at all. Misleading message reported by kn@ on tech@.
* socppc makes an extended visit to the bigbucket;Ingo Schwarze2019-05-211-1/+1
| | | | patch from deraadt@; OK kettenis
* avoid duplicate "bad argument" error message, also shortening the codeIngo Schwarze2019-05-032-7/+3
|
* when processing unknown output options, prevent passing NULL to printf;Ingo Schwarze2019-05-031-2/+3
| | | | patch from anton@
* Enter dangling .so links into the database, to avoid harassingIngo Schwarze2019-05-031-6/+11
| | | | | | | | | users of man(1) about running makewhatis(8), which won't help. Seeing the content of the broken .so request might even help users to figure out how to access the manual page they want. Fixing the last issue reported by Lorenzo Beretta <loreb at github> as part of https://github.com/void-linux/void-packages/issues/9868 .
* In fs_lookup(), use stat(2) rather than access(2) to check file existence.Ingo Schwarze2019-05-032-12/+11
| | | | | | | | | | | Some mildly broken real-world packages on some operating systems contain dangling symlinks in manual page directories: pestering the user to run makewhatis(8) makes no sense because that won't help. On the other hand, missing read permissions deserve ugly error messages and are unlikely to occur in practice anyway. Fixing an issue reported by Lorenzo Beretta <loreb at github> as part of https://github.com/void-linux/void-packages/issues/9868 .
* In man(1) mode with a specific section requested,Ingo Schwarze2019-05-032-17/+16
| | | | | | | | | | | | | | | | try harder to find the best match. Use this order of preference: 1. The section in both the directory name and the file name matches exactly. 2. The section in the file name matches exactly. 3. The section in the directory name matches exactly. 4. Neither of them matches exactly. The latter can happen when mansearch() finds substring matches or when the second .Dt argument mismatches the dir and file names. Lorenzo Beretta <loreb at github> reported that this caused real problems on Void Linux, like "man 3 readline" showing readline(3m). See https://github.com/void-linux/void-packages/issues/9868 for details.
* In man(1) mode, when the first argument starts with a digit,Ingo Schwarze2019-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | optionally followed by a letter, and at least one more argument follows, interpret the first argument as a section name even when additional characters follow after the digit and letter. This is needed because many operating systems have section names consisting of a digit followed by more than one letter - for example Illumos, Solaris, Linux, even NetBSD. There is very little risk of regressions: in the whole corpus of manual pages on man.openbsd.org, there isn't a single manual page name starting with a digit. And even if programs like "0ad" or "4channels" had manual pages, "man 0ad" and "man -a cat 0ad" would still work, only "man -a 0ad cat" will fail with "man: No entry for cat in section 0ad of the manual." Fixing one of the issues reported by Lorenzo Beretta <loreb at github> as part of https://github.com/void-linux/void-packages/issues/9868 .
* In man(1) mode, i.e. when asking for a single manual page by name,Ingo Schwarze2019-04-304-8/+9
| | | | | | | | | | | | prefer file name matches over .Dt/.TH matches over first NAME matches over later NAME matches, but do not change the ordering for apropos(1) nor for man -a. This reverts main.c rev. 1.310 and mansearch.h rev. 1.29 and includes a partial revert of mansearch.c rev. 1.79. Regression reported by Lorenzo Beretta <loreb at github> as part of https://github.com/void-linux/void-packages/issues/9868 .
* In HTML output, allow switching the desired font for subsequentIngo Schwarze2019-04-305-67/+35
| | | | | | | | text without printing an opening tag right away, and use that in the .ft request handler. While here, garbage collect redundant enum htmlfont and reduce code duplication in print_text(). Fixing an assertion failure reported by Michael <Stapelberg at Debian> in pmRegisterDerived(3) from libpcp3-dev.
* improve the description of the message "blank line in fill mode";Ingo Schwarze2019-04-301-1/+4
| | | | triggered by a misunderstanding by sashan@
* clarify the difference between .Cm and .Ic;Ingo Schwarze2019-04-241-8/+10
| | | | triggered by a question from Fabio Scotoni
* clarify how .%P is conventionally used;Ingo Schwarze2019-04-231-1/+8
| | | | triggered by a question from Fabio Scotoni <fabio at esse dot ch>
* add missing "pp." to .%P macro;Ingo Schwarze2019-04-231-1/+1
| | | | reported by Fabio Scotoni <fabio at esse dot ch>
* issues found by Jan Stary in groffer(1) version 1.19Ingo Schwarze2019-04-231-0/+21
|
* When calling an empty macro, do not clobber existing arguments.Ingo Schwarze2019-04-214-4/+36
| | | | | Fixing a bug found with the groffer(1) version 1.19 manual page following a report from Jan Stary.
* Implement the roff .break request (break out of a .while loop).Ingo Schwarze2019-04-215-12/+73
| | | | | | | Jan Stary <hans at stare dot cz> found it in an ancient groffer(1) manual page (version 1.19) on MacOS X Mojave. Having .break not implemented wasn't a particularly bright idea because obviously, it tended to cause infinite loops.
* new man(1) issues from Lorenzo Beretta <loreb at github>Ingo Schwarze2019-04-011-0/+24
|
* While we do encourage simplicity in the sense of writing plain '-'Ingo Schwarze2019-03-311-2/+2
| | | | | | | | for hyphen-minus, soften the language a bit: writing \- for it is not wrong, and people started sending us patches to replace \- with '-' in existing manual pages, which is not a worthwhile change unless the \- is used at a place where it doesn't belong. OK jmc@
* Set the maximum column index in a tbl(7) to the maximum *right* edgeIngo Schwarze2019-03-291-1/+1
| | | | | | | | | | | | | | | of any cell span, not to the maximum *left* edge, which may be smaller if the last column of the table is only reached by horizontal spans, but not by any regular cell in any row of the table. Otherwise, the algorithm calculating column widths accessed memomy after the end of the colwidth[] array, while it was trying to handle the rightmost column(s). Crash reported by Jason Thorpe <thorpej at NetBSD> via https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=54069 and via Thomas Klausner (wiz@). Christos@ Zoulas sent a (correct, but slightly confusing) patch. The patch i'm committing here is easier to understand.
* When the last line of the input is empty and the previous line reducedIngo Schwarze2019-03-191-0/+2
| | | | | | | the line input buffer to a length of one byte, do not write one byte past the end of the line input buffer. Minimal code to show the bug: printf ".ds X\n.X\n\n" | MALLOC_OPTIONS=C mandoc Bug found by bentley@ in the sysutils/rancid par(1) manual page.
* fix a NULL pointer access on empty tbl(7) data cellsIngo Schwarze2019-03-181-2/+4
| | | | that bentley@ found in syncthing-bep(7)
* The header file "html.h" uses enum roff_tok,Ingo Schwarze2019-03-174-43/+64
| | | | | | so "roff.h" must be included before it. Diff from bcallah@ tweaked by me; he found the bug by compiling with pcc.
* When drawing a horizontal line in tbl(7) UTF-8 output, it is notIngo Schwarze2019-03-161-12/+17
| | | | | | | | | | | | | sufficient to look at two data rows, but up to three are needed: the one above to identify vertical lines branching off upward, the row itself (in case the line is in a data row rather than a layout line) to figure out the horizontal line style, and the row below to identify vertical lines branching off downward. As an example, bentley@ reported from the mpv(1) manual page that in a tbl(7) having a vertical line in the middle and a horizontal line in the bottom data row, the vertical line extended below the bottom horizontal line.
* Contrary to what the NetBSD attribute(3) manual page suggests,Ingo Schwarze2019-03-132-4/+4
| | | | | | | | | | | | | using __dead instead of __attribute__((__noreturn__)) actually hinders portability rather than helping it. Given that mandoc already uses __attribute__ in several files and that in the portable version, ./configure already contains rudimentary support for ignoring it on platforms that do not support it, use __attribute__ directly. This is expected to fix build failures that Stephen Gregoratto <dev at sgregoratto dot me> reported from Arch and Debian Linux.
* mark check_abort() and post_abort() as __dead;Ingo Schwarze2019-03-112-4/+4
| | | | based on a patch by Christos@ Zoulas at NetBSD
* release 1.14.5VERSION.1.14.5Ingo Schwarze2019-03-101-4/+9
|
* Automatically detect whether diff(1) supports the -a option.Ingo Schwarze2019-03-101-0/+1
| | | | | Useful on illumos and on Oracle Solaris, where it doesn't. Patch written based on a report from Sevan Janiyan.
* Mention mandoc.db(5), makewhatis(8), and weekly(8).Ingo Schwarze2019-03-091-0/+12
| | | | Omission noticed by espie@ long ago, and wording tweaked by jmc@.
* new dist-install maintainer targetIngo Schwarze2019-03-061-0/+4
|
* while $() is more modern than ``, it does not work with theIngo Schwarze2019-03-061-1/+1
| | | | default /bin/sh on Solaris 10, so use the classical form