summaryrefslogtreecommitdiffstats
path: root/read.c
Commit message (Collapse)AuthorAgeFilesLines
* Style message about bad input encoding of em-dashes as -- instead of \(em.Ingo Schwarze2018-03-161-0/+1
| | | | Suggested by Thomas Klausner <wiz at NetBSD>; discussed with jmc@.
* After opening a file with gzdopen(3), we have to call gzclose(3) orIngo Schwarze2018-02-231-6/+31
| | | | | | we leak memory internally used by zlib to keep compression state. Bug reported by Wolfgang Mueller <vehk at vehk dot de> who also provided an incomplete patch, part of which i'm using in this commit.
* be less assertive when warning about a possible typo;Ingo Schwarze2017-11-101-1/+1
| | | | from jca@, ok jmc@
* Do not call err(3) from the parser. Call mandoc_vmsg() andIngo Schwarze2017-07-201-9/+15
| | | | return failure such that we can continue with the next file.
* Simplify by creating struct roff_node syntax tree nodes for tbl(7)Ingo Schwarze2017-07-081-14/+1
| | | | | | | | | | | | right from roff_parseln() rather than delegating to read.c, similar to what i just did for eqn(7). The interface function roff_span() becomes obsolete and is deleted, the former interface function roff_addtbl() becomes static, the interface functions tbl_read() and tbl_cdata() become void, and minus twelve linus of code. No functional change.
* 1. Eliminate struct eqn, instead use the existing membersIngo Schwarze2017-07-081-3/+0
| | | | | | of struct roff_node which is allocated for each equation anyway. 2. Do not keep a list of equation parsers, one parser is enough. Minus fifty lines of code, no functional change.
* Now that we have the -Wstyle message level, downgrade six warningsIngo Schwarze2017-07-061-8/+8
| | | | | | that are not syntax mistakes and that do not cause wrong formatting or content to style suggestions. Also upgrade two warnings that may cause information loss to errors.
* Printing "BASE:" in messages about violations of base system conventionsIngo Schwarze2017-07-041-1/+1
| | | | | is confusing, simply print "STYLE:", which is intuitive and does not sound excessively alarming; suggested by jmc@, OK tedu@ jmc@.
* report trailing delimiters after macros where they are usually a mistake;Ingo Schwarze2017-07-031-1/+1
| | | | the idea came up in a discussion with Thomas Klausner <wiz at NetBSD>
* warn about time machines; suggested by Thomas Klausner <wiz @ NetBSD>Ingo Schwarze2017-07-031-0/+1
|
* add warning "cross reference to self"; inspired by mdoclintIngo Schwarze2017-07-021-0/+1
|
* Basic reporting of .Xrs to manual pages that don't existIngo Schwarze2017-07-011-0/+1
| | | | | | | | | | | | in the base system, inspired by mdoclint(1). We are able to do this because (1) the -mdoc parser, the -Tlint validator, and the man(1) manual page lookup code are all in the same program and (2) the mandoc.db(5) database format allows fast lookup. Feedback from, previous versions tested by, and OK jmc@. A few features will be added to this in the tree, step by step.
* warn about some non-portable idioms in .Bl -column;Ingo Schwarze2017-06-291-0/+2
| | | | triggered by a question from Yuri Pankov (illumos)
* Catch typos in .Sh names; suggested by jmc@.Ingo Schwarze2017-06-251-0/+1
| | | | | | I'm using a very simple, linear time / zero space fuzzy string matching heuristic rather than a full Levenshtein metric, to keep the code both simple and fast.
* operating system dependent message about unknown architecture;Ingo Schwarze2017-06-241-0/+1
| | | | inspired by mdoclint
* in the base system, suggest leaving .Os blank; inspired by mdoclintIngo Schwarze2017-06-241-0/+1
|
* Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze2017-06-241-12/+16
| | | | | | | | | | | | | | | -Wopenbsd and -Wnetbsd to check conventions for the base system of a specific operating system. Mark operating system specific messages with "(OpenBSD)" at the end. Please use just "-Tlint" to check base system manuals (defaulting to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the manuals of portable software projects you maintain that are not part of OpenBSD base, to avoid bogus recommendations about base system conventions that do not apply. Issue originally reported by semarie@, solution using an idea from tedu@, discussed with jmc@ and jca@.
* style message about duplicate RCS ids; inspired by mdoclintIngo Schwarze2017-06-171-0/+1
|
* style message about missing RCS ids; inspired by mdoclintIngo Schwarze2017-06-171-0/+1
|
* Style message about legacy man(7) date format in mdoc(7) documentsIngo Schwarze2017-06-111-0/+3
| | | | | and operating system dependent messages about missing or unexpected Mdocdate; inspired by mdoclint(1).
* style message about missing .Fn markup; inspired by mdoclintIngo Schwarze2017-06-111-0/+1
|
* style message about missing blank before trailing delimiter;Ingo Schwarze2017-06-101-0/+1
| | | | inspired by mdoclint(1), and jmc@ considers it useful
* warning about unknown .Lb arguments; inspired by mdoclint(1)Ingo Schwarze2017-06-081-0/+1
|
* style checks related to .Er; inspired by mdoclint(1)Ingo Schwarze2017-06-071-0/+2
|
* Minimal implementation of the roff(7) .ce request (center a numberIngo Schwarze2017-06-061-0/+1
| | | | | of input lines without filling). Contrary to groff, high-level macros abort .ce mode for now.
* Pure preprocessor implementation of the roff(7) .ec and .eo requestsIngo Schwarze2017-06-041-69/+3
| | | | | | | | | | | | | | | | | (escape character control), touching nothing after the preprocessing stage and keeping even the state variable local to the preprocessor. Since the escape character is also used for line continuation, this requires pulling the implementation of line continuation from the input reader to the preprocessor, which also considerably shortens the code required for that. When the escape character is changed, simply let the preprocessor replace bare by escaped backslashes and instances of the non-standard escape character with bare backslashes - that's all we need. Oh, and if anybody dares to use these requests in OpenBSD manuals, sending a medium-sized pack of axe-murderers after them might be a worthwhile part of the punishment, but probably insuffient on its own.
* ignore blank lines in man(7) next line scope;Ingo Schwarze2017-06-031-0/+1
| | | | strange groff edge case behaviour found in multimedia/mjpegtools
* STYLE message about full stop at the end of .Nd; inspired by mdoclint(1)Ingo Schwarze2017-06-011-0/+1
|
* STYLE message about missing use of Ox/Nx/Fx/Dx; OK jmc@ wiz@Ingo Schwarze2017-05-311-0/+1
|
* STYLE message about useless macros we don't want (Bt Tn Ud);Ingo Schwarze2017-05-301-0/+3
| | | | not a WARNING because they don't endanger portability
* Introduce a new mandoc(1) message level, -W style, below -W warning.Ingo Schwarze2017-05-161-2/+3
| | | | | | | | | | | | | Switch -W all from meaning -W warning to meaning -W style. The meaning of -T lint does *not* change, it still implies -W warning. No messages on the new level yet, but they will come. Usually, i do not lightly make the user interface larger. But this has been planned for years, and EXIT STATUS 1 was reserved for it all the time. The message system is now stable enough to finally implement it. jmc@ regarding the concept: "really good idea"
* Parser unification: use nice ohashes for all three request and macro tables;Ingo Schwarze2017-04-291-6/+11
| | | | no functional change, minus two source files, minus 200 lines of code.
* If a user-defined macro is aborted because it exceeds the stackIngo Schwarze2017-03-071-8/+12
| | | | | | | | | | | | | | | | | | | limit, usually due to infinite recursion, discard whatever remains in all those open stack levels. Otherwise, insane constructions like the following could generate macros of enormous size, causing mandoc(1) to die from memory exhaustion: .de m \" original macro definition .m \" recursion to blow up the stack .de m \" definition to be run during the call of .m marked (*) very long plain text (some kilobytes) .m \" expand the above a thousand times while unwinding the stack .. \" end of the original definition .m \" (*) recursively generate a ridiculously large macro .. \" end of recursively generated definition .m \" execute the giant macro, exhausting memory Very creative abuse found by tb@ with afl(1).
* Using .Nd only makes sense in the NAME section.Ingo Schwarze2017-03-061-0/+1
| | | | | Warn if that macro occurs elsewhere. Triggered by a question from Dag-Erling Smoergrav <des @ FreeBSD>.
* resolve trivial differences with OpenBSD:Ingo Schwarze2017-02-181-3/+1
| | | | | * we include <sys/types.h> for size_t, so we don't need <stdint.h> * sort declarations in read_whole_file()
* Minor cleanup, no functional change:Ingo Schwarze2017-02-031-6/+6
| | | | | | | We always have a roff parser, so mparse_free() does not need to check for existence before freeing it. Also arrange code in struct mparse, mparse_reset(), and mparse_free() in the same order for readability.
* If an application parses multiple files with mparse_readfd(3) butIngo Schwarze2017-02-031-0/+1
| | | | | | | | | without using mparse_open(3) to open the files, and if one of the files includes a gzip'ed file with .so, then the gzip flag remains set and the next main file will be expected to be gzip'ed. Fix this by clearing the gzip flag in mparse_reset(3). Bug found and patch provided by Michael <Stapelberg at debian dot org>.
* Add a warning "new sentence, new line".Ingo Schwarze2017-01-281-0/+1
| | | | | | | | | This does not attempt to pinpoint each and every offender, but instead tries very hard to avoid false positives: Currently, there are only two false positives in the whole OpenBSD base system. Only do this in mdoc(7), not in man(7), because manuals written in man(7) typically have much worse problems than this. OK jmc@ on a previous version of the patch
* Warnings and errors that occur during mdoc_validate()Ingo Schwarze2017-01-091-0/+7
| | | | | | or during man_validate() have to affect the mandoc(1) EXIT STATUS. Many thanks to <Yuri dot Pankov at gmail dot com> (illumos developer) for reporting this regression.
* Stricter validation of the NAME section, in particular:Ingo Schwarze2017-01-081-2/+3
| | | | | | | - require a comma between names - reject all other text nodes - reject all empty Nm below NAME, not only in the leading position - reject Nm after Nd
* Make the second, section number argument of .Xr mandatory.Ingo Schwarze2016-12-281-0/+1
| | | | | | In fact, we have been requiring it for many years. The only reason to not warn when it was missing was excessive traditionalism - it was optional in 4.4BSD.
* When reporting "whitespace at end of input line" on lines ending withIngo Schwarze2016-12-071-1/+3
| | | | | | roff(7) comments, let the column number in the message point to the end of the line rather than to the beginning of the comment. Improvement suggested by bluhm@.
* warn about trailing whitespace at the end of comments;Ingo Schwarze2016-11-101-5/+11
| | | | missing feature noticed by jmc@
* Delete complicated code dealing with .Bl -tag without -width,Ingo Schwarze2016-10-091-1/+1
| | | | | | | | | | | | and just let it default to -width 6n, which agrees with the traditional -width Ds that is still in widespread use. I just pushed a patch upstream to GNU roff that does the same for groff_mdoc(7). Before, groff contained code that was even more complicated than mandoc, but both resulted in quite different user-visible output. Now, both agree, and output is nicer for both. Useless complication noticed by Carsten Kunze (Heirloom roff).
* Remove the dependency on SQLite without loss of functionality.Ingo Schwarze2016-07-191-6/+0
| | | | | Stop supporting systems that don't have mmap(3). Drop the obsolete names_check() now that we deleted MLINKS.
* Since the mdoc/man parser unification, the parser is always allocatedIngo Schwarze2016-07-191-24/+2
| | | | | | in mparse_alloc(), so delete all the curp->man == NULL checks. Triggered by a patch from Christos Zoulas suggesting to add yet another such check.
* Fix a nasty typo that prevented .so links to gziped manualsIngo Schwarze2016-07-101-1/+1
| | | | | from working in the absence of a mandoc.db(5) database. Found the hard way by Svyatoslav Mishyn on Crux Linux.
* Simplify the mparse_open() interface.Ingo Schwarze2016-01-081-11/+11
| | | | | | Just return the file descriptor or -1 on error; there is just one kind of error anyway. Suggested by Christos Zoulas (NetBSD).
* It was very surprising that a function called mparse_readfd()Ingo Schwarze2016-01-081-4/+1
| | | | | | | | | | | | | closed the file descriptor passed to it after completing its work, in particular considering the fact that it required its callers to call open(2) or mparse_open() beforehand. Change mparse_readfd() to not call close(2) and change the callers to call close(2) afterwards, more or less bringing open and close to the same level of the code and making review easier. Note that man.cgi(8) already did that, even though it was wrong in the past. Small restructuring suggested by Christos Zoulas (NetBSD).
* Without HAVE_ERR, don't try to include <err.h>, it probably isn't there.Ingo Schwarze2015-11-071-0/+2
| | | | | In that case, the required prototypes are in "config.h". Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.