summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
2013-11-21My audit of mandoc revealed two missing (unsigned char) castsIngo Schwarze
in isspace() and tolower() arguments containing arbitrary char data. Thanks to deraadt@ for triggering the audit.
2013-11-11In the parser, when closing an explicit block that is not open,Ingo Schwarze
close below-subsection implicit scopes that may still be open. In the formatter, make sure indentation is reset when leaving a scope, not only when entering the next one. Improves the formatting of gpg(1); issue reported by jca on ports.
2013-11-10Ignore blank lines right after .SH and .SS.Ingo Schwarze
Improves the rendering of gpg(1); issue reported by jca on ports.
2013-11-10Support the alternative syntax \C'uXXXX' for Unicode characters.Ingo Schwarze
It is already documented in the Heirloom troff manual, and groff handles it as well. Bug reported by Bjarni Ingi Gislason <bjarniig at rhi dot hi dot is> on <bug-groff at gnu dot org>. Well, admittedly, that bug was reported against groff, but mandoc was even more broken than groff with respect to this syntax...
2013-10-22Parse and ignore .hw (hyphenation points in words); this is safe becauseIngo Schwarze
we don't do hyphenation anyway, so there is no point in throwing an ERROR when encountering .hw. Real-world usage of the request found by naddy@ in sysutils/dwdiff(1).
2013-10-21There are three kinds of input lines: text lines, macros takingIngo Schwarze
positional arguments (like Dt Fn Xr) and macros taking text as arguments (like Nd Sh Em %T An). In the past, even the latter put each word of their arguments into its own MDOC_TEXT node; instead, concatenate arguments unless delimiters, keeps or spacing mode prevent that. Regarding mandoc(1), this is internal refactoring, no output change intended. Once we will switch mandocdb(8) from DB to SQLite in the future, this is going to be required to support search expressions crossing word boundaries, and it will reduce both database sizes and build times by a bit more than 5% each.
2013-10-17Implement the .UR/.UE block (uniform resource identifier) introduced in theIngo Schwarze
man-ext macros by Eric S. Raymond, enabled by default in groff_man(7). Usual disclaimer: You don't write new man(7) code, so you are not going to use these, either. Improves e.g. the bzr(1) and etherape(1) manuals. Thanks to naddy@ for bringing these to my attention.
2013-10-14Parse and ignore the .fam (font family) request.Ingo Schwarze
Fixes irunner(1) in devel/ipython and uim-xim(1) in inputmethods/uim. Thanks to naddy@ for bringing these to my attention.
2013-10-13add libppath; Thomas Klausner, NetBSD rev. 1.4, Aug 29, 2011Ingo Schwarze
2013-10-13add libefi and simplify some namesIngo Schwarze
from FreeBSD ports SVN rev. 293734, Ulrich Spoerlein March 24, 2012 in case of conflicts with NetBSD, i keep the simpler NetBSD names
2013-10-13sync SUSv2/SUSv3 entries with groffIngo Schwarze
reduces groff-mandoc-differences for several pthread_*(3) manuals noticed by Franco Fichtner <franco at lastsummer dot de> dragonfly.git/commitdiff/370c546b87777b40b5fc862491555ef71b4ee130
2013-10-13more DragonFly libraries; Franco Fichtner <franco at lastsummer dot de>Ingo Schwarze
dragonfly.git/commit/107cb94cae2c24ce3f6851ce0ed24b80d64e3ec8
2013-10-07Printf size_t vars with %zu, not %ld;Ingo Schwarze
from Antonio Huete Jimenez <tuxillo at quantumachine dot net> via Franco Fichtner (both DragonFly).
2013-10-07Yesterday, i released (portable) mandoc 1.12.2, so bump our VERSION, too.Ingo Schwarze
No merging is needed; basically, mandoc is developed here and mdocml.bsd.lv is not really "upstream", but just OpenBSD plus compatibility goo. All the same, the exercise is far from useless: NetBSD, FreeBSD, and DragonFly have mandoc in base, NetBSD uses it by default to show manuals, and FreeBSD and DragonFly have finally come close to switching away from groff as well. Useful bug reports come in and help making our mandoc better. Maybe we should list mandoc as an OpenBSD associated project on index.html.
2013-10-06We don't do hyphenation, but we allow breaking the line at hyphens that areIngo Schwarze
already there in the middle of words. So far, we only allowed this on text lines. Now it turns out some macros allow this for their arguments, too, in particular .Nd and most of the .%? citation macros. Issue found by Franco Fichtner <franco at lastsummer dot de> while doing systematic groff-mandoc comparisons in the DragonFly base system, THANKS! While here, garbage collect two empty prevalidator function pointer lists and sort a couple of function declarations.
2013-10-06If there is random stuff inside a .Bl block body before the first .It,Ingo Schwarze
do not throw a FATAL error and do not die, but just throw a WARNING and move the stuff out of the .Bl block. This bug felt completely 2008-ish; meanwhile, such bugs from the Kristaps-doesnt-like-syntax-errors-so-lets-just-give-up--Era are becoming rare, but this was one of the last survivors. Thanks to bentley@ for reminding me to finally fix this.
2013-10-05Cleanup suggested by gcc-4.8.1, following hints by Christos Zoulas:Ingo Schwarze
- avoid bad qualifier casting in roff.c, roff_parsetext() by changing the mandoc_escape arguments to "const char const **" - avoid bad qualifier casting in mandocdb.c, index_merge() - garbage collect a few unused variables elsewhere
2013-10-04Support simple numerical conditions.Ingo Schwarze
Original code from Christos Zoulas, NetBSD rev. 1.11-1.13, April 3, 2013. I tweaked the code as follows: * In roff_getnum(), don't skip a minus that isn't followed by a digit. * In roff_getop(), do not handle "!=", groff doesn't support it either. * In roff_evalcond(), treat negative numbers as false, like groff. Besides, make the interfaces of roff_getnum() and roff_getop() more similar to each other and simplify parts of the code a bit.
2013-10-03ROFFRULE_ALLOW = 0, ROFFRULE_DENY = 1 was confusing, so exchange theIngo Schwarze
two entries in enum roffrule; no functional change. From Christos Zoulas, NetBSD rev. 1.11, April 4, 2013.
2013-10-03Avoid code duplication in roff_parseln() as suggested byIngo Schwarze
Christos Zoulas in NetBSD rev. 1.11; i'm even going a step further and making this yet a bit shorter. No functional change.
2013-10-03Expand references to number registers in exactly the same way asIngo Schwarze
references to user-defined strings. While here, make number registers signed int, like in groff. Inspired by NetBSD roff.c rev. 1.8 and read.c rev. 1.7 written by Christos Zoulas on March 21, 2013, but implemented in a completely different way, without hacking into read.c, where this functionality really doesn't belong.
2013-10-03Support setting arbitrary roff(7) number registers,Ingo Schwarze
preserving read support for the ".nr nS" SYNOPSIS state register; read support for arbitrary registers is still not available. Inspired by NetBSD roff.c rev. 1.18 (Christos Zoulas, March 21, 2013), but implemented differently. I don't want to have yet another different implementation of a hash table in mandoc - it would be the second one in roff.c alone and the fifth one in mandoc grand total. Instead, i designed and implemented roff_setreg() and roff_getreg() to be similar to roff_setstrn() and roff_getstrn(). Once we feel the need to optimize, we can introduce one common hash table implementation for everything in mandoc.
2013-10-03sync with NetBSDIngo Schwarze
2013-09-16One of the WARNING messages has to use the word "section" twice in twoIngo Schwarze
different meanings, that cannot be helped. But we can make this less confusing by stating that the second instance refers to stuff like (2), (3), and (9), and by adding the sections header the first instance refers to, for example ERRORS or RETURN VALUES. Source for confusion noticed by Jan Stary <hans at stare dot cz>, better wording suggested by jmc@, tweaked by me.
2013-09-15Use normal line macro recognition, do not attempt to roll your own.Ingo Schwarze
This fixes horizontal spacing when an Ns macro follows a block-closing macro and the corresponding block-opening macro is not on the same line.
2013-09-15Block closing macros do not allocate a new node but finish an existingIngo Schwarze
one, so they miss the clearing of MDOC_NEWLINE in mdoc.c, node_alloc(). Consequently, MDOC_NEWLINE must be cleared before processing the next macro on the same line. This fixes horizontal spacing for input lines beginning like .Oc Ns ... Issue found by Franco Fichtner <franco at lastsummer dot de> while working on DragonFly mandoc integration.
2013-09-15For some mdoc(7) macros, it is (unfortunately) semantically significantIngo Schwarze
whether they are the first macro on the line or called by another macro. To help debugging, indicate this property "first macro on a new input line" by prefixing an asterisk to the line number in -Ttree output.
2013-09-04Beagle has been replaced by armv7.Patrick Wildt
2013-08-21Move the last column-counting members of struct termp (col and maxcols)Ingo Schwarze
from int to size_t, to match some existing ones (offset, *rmargin, viscol). Move some related local variables from int to size_t as well. Needed as a preparation to make a generalized adjbuf() function available beyond the file term.c, i.e. in mandoc.c. Also saves a couple of ugly casts.
2013-08-08Implement the roff(7) font-escape sequence \f(BI "bold+italic".Ingo Schwarze
This improves the formatting of about 40 base manuals and reduces groff-mandoc formatting differences in base by about 5%.
2013-08-06Remove support for COMPILER_VERSION == gcc2.Miod Vallat
Change the logic depending upon COMPILER_VERSION everywhere, to assume gcc4 is the norm and to explicitely test for gcc3 when a different behaviour is required. No functional change intended. Be sure to `make install' in share/mk before attempting to do anything.
2013-08-05After a leading blank on an output line, the first word was counted twiceIngo Schwarze
against vend, causing a premature line break. Fix that bug by reverting revision 1.10 which Kristaps committed four years ago. Kristaps patch is no longer needed because the code below /* Write out the [remaining] word. */ now handles leading blanks correctly, probably already for a long time. This avoids premature line breaks in about a dozen base system manuals, for example as(1) and gdb(1), and alignment issues in another twenty, for example mount(2), ip6(4), pfctl(8), and crypto(9).
2013-08-05Put .%C before .%D in .Rs outputIngo Schwarze
because that's the usual order in formal citations. My patch that was accepted into groff by Werner Lemberg uses the same order, so keep groff and mandoc consistent. Committing now because jmc@ already starts to rely on the .%C macro, see for example /usr/src/usr.bin/bdes/bdes.1 rev. 1.11.
2013-07-13For citing the names and email addresses of authors,Ingo Schwarze
consistently use the style ".An name Aq Mt email". Triggered by a question from Jan Stary <hans at stare dot cz>, ok jmc@.
2013-07-13Rudimentary implementation of the .it request (input line trap).Ingo Schwarze
As with any low-level roff request involving subtle interactions with macro internals, this implementation is not exact, but it does handle the simplest cases. This request occurs in man(7) code generated from DocBook, for example mysql(1) and yasm_arch(7). Thanks to brad@ for reporting the issue back in January 2011.
2013-07-12Simple partial sync to bsd.lv:Ingo Schwarze
* Without arguments, show the usage line and EXIT_FAILURE. * Resolve some gratuitious differences (order, parantheses, white space, etc).
2013-06-27Parse for the closing delimiter `\}' for conditionalsIngo Schwarze
even when the conditional evaluated to false. While here, reshuffle the code to reduce indentation and make it more readable; that way, we can even trim down the comments because it becomes obvious what the code does. Found in zipinfo(1) - thanks to espie@ and naddy@ for making me look at that manual page.
2013-06-20Improve handling of the roff(7) "\t" escape sequence:Ingo Schwarze
* Parsing macro arguments has to be done in copy mode, which implies replacing "\t" by a literal tab character. * Otherwise, render "\t" as the empty string, not as a 't' character. This fixes formatting of the distfile example in the oldrdist(1) manual. This also shows up in the unzip(1) manual as one of several issues preventing the removal of USE_GROFF from the archivers/unzip port. Thanks to espie@ for attracting my attention to the unzip(1) manual.
2013-06-17Add .St values for POSIX 1003.1d, 1003.1j, and 1003.1qPhilip Guenther
Tweak descriptions of the other POSIX 1003.1<letter> standards Sort a few others into their proper places Discussed with schwarze@ at t2k13
2013-06-05Some places used PATH_MAX from <limits.h>, some MAXPATHLEN from <sys/param.h>.Ingo Schwarze
Consistently use the PATH_MAX since it is specified by POSIX, while MAXPATHLEN is not.
2013-06-02Let .Do .Dq .Ql .So .Sq generate the correct roff(7) character escapeIngo Schwarze
sequences such that output modes like -Tutf8 have a chance to select nice glyphs. This doesn't change anything for -Tascii, and, for now, it doesn't affect -Tps and -Tpdf either. OK matthew@ bentley@; like the idea tedu@; no opinion jmc@.
2013-06-02Sync with bsd.lv, reshuffling the code a bit among mparse_readfd() andIngo Schwarze
mparse_parse_buffer(), no functional change intended. Exclude the following from the sync: - Skip the mparse_readmem() function, it's useless in OpenBSD. - Thus, UNCONST isn't used, so no need for "main.h" and <stdint.h>. - Skip HAVE_CONFIG_H (always off here) and HAVE_MMAP (always on here).
2013-06-01This file contains too much complexity.Ingo Schwarze
Remove one layer of indirection by deleting mparse_readfd_r() and doing its work in the public mparse_readfd(). As a bonus, catch recursive .so. This is part of the preparations to resync to mdocml.bsd.lv.
2013-06-01Use a standard locale name, "UTF-8" is an ugly non-standard aliasIngo Schwarze
that doesn't work on OpenBSD. OK tedu@ naddy@
2013-06-01If a table contained at least one complete lineIngo Schwarze
and on its last line, the first T{ remained unclosed, roff_parseln() never returned ROFF_TBL for that last line, so {man,mdoc}_addspan() never got called for that last line, so we ended up with a table where no line associated with a node had TBL_SPAN_LAST set, so tbl_term() never free()'d the cols in struct roffcol, so tblcalc() crashed on the NULL == tbl->cols assertion when starting the *next* table in the same file. Fix this by returning ROFF_TBL as soon as we open a data cell, not only when finishing it - as explained above, it may never get properly closed but instead be interrupted by .TE. Problem reported by bentley@ in latex2man.1. I love it when bugs take half a day to debug but the fix turns out to be flipping one single bit in the source code.
2013-05-31More cleanup: Consistently use the name "struct tbl_node *tbl"Ingo Schwarze
that is already used almost everywhere instead of gratuitiously inventing different names at four places. No functional change.
2013-05-31The name "struct tbl" was badly misleading for two reasons:Ingo Schwarze
1) This struct almost exclusively contains the table options. 2) Information about the table as a whole is actually in "struct tbl_node". Besides, "struct tbl" was almost impossible to search for. So rename it to "struct tbl_opts". No functional change.
2013-05-30Reject non-printable characters found in the input stream even whenIngo Schwarze
preceded by a backslash; otherwise, the escape sequence would later be identified as invalid and the non-printable character would be passed through to the output backends, sometimes triggering assertions. Reported by Mike Small <smallm at panix dot com> on the mdocml discuss list.
2013-05-29Trivial sync to bsd.lv:Ingo Schwarze
Kristaps changed the size member of struct manpaths from int to size_t. No functional change.
2013-05-29Simplify condition, avoid duplicate code; no functional change.Ingo Schwarze