aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
Commit message (Collapse)AuthorAgeFilesLines
* Catch typos in .Sh names; suggested by jmc@.Ingo Schwarze2017-06-251-1/+2
| | | | | | 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-1/+2
| | | | inspired by mdoclint
* in the base system, suggest leaving .Os blank; inspired by mdoclintIngo Schwarze2017-06-241-1/+2
|
* Split -Wstyle into -Wstyle and the even lower -Wbase, and addIngo Schwarze2017-06-241-13/+17
| | | | | | | | | | | | | | | -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-1/+2
|
* style message about missing RCS ids; inspired by mdoclintIngo Schwarze2017-06-171-1/+2
|
* Style message about legacy man(7) date format in mdoc(7) documentsIngo Schwarze2017-06-111-1/+4
| | | | | 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-1/+2
|
* style message about missing blank before trailing delimiter;Ingo Schwarze2017-06-101-1/+2
| | | | inspired by mdoclint(1), and jmc@ considers it useful
* warning about unknown .Lb arguments; inspired by mdoclint(1)Ingo Schwarze2017-06-081-1/+2
|
* style checks related to .Er; inspired by mdoclint(1)Ingo Schwarze2017-06-071-1/+3
|
* Minimal implementation of the roff(7) .ce request (center a numberIngo Schwarze2017-06-061-1/+2
| | | | | 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-70/+4
| | | | | | | | | | | | | | | | | (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-1/+2
| | | | 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-1/+2
|
* STYLE message about missing use of Ox/Nx/Fx/Dx; OK jmc@ wiz@Ingo Schwarze2017-05-311-1/+2
|
* STYLE message about useless macros we don't want (Bt Tn Ud);Ingo Schwarze2017-05-301-1/+4
| | | | 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-3/+4
| | | | | | | | | | | | | 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-7/+12
| | | | 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-9/+13
| | | | | | | | | | | | | | | | | | | 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-1/+2
| | | | | 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-4/+2
| | | | | * 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-7/+7
| | | | | | | 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-1/+2
| | | | | | | | | 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-1/+2
| | | | | | | | | 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-1/+8
| | | | | | 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-3/+4
| | | | | | | - 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-1/+2
| | | | | | 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-2/+4
| | | | | | 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-6/+12
| | | | missing feature noticed by jmc@
* Delete complicated code dealing with .Bl -tag without -width,Ingo Schwarze2016-10-091-2/+2
| | | | | | | | | | | | 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-7/+1
| | | | | 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-25/+3
| | | | | | 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-2/+2
| | | | | 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-12/+12
| | | | | | 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-5/+2
| | | | | | | | | | | | | 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-1/+3
| | | | | In that case, the required prototypes are in "config.h". Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.
* If a .Bd block has no arguments at all, drop the block and only keepIngo Schwarze2015-10-301-1/+2
| | | | | its contents. Removing a gratuitious difference to groff output found after a related bug report from krw@.
* Major character table cleanup:Ingo Schwarze2015-10-131-5/+3
| | | | | | | | | | | | | * Use ohash(3) rather than a hand-rolled hash table. * Make the character table static in the chars.c module: There is no need to pass a pointer around, we most certainly never want to use two different character tables concurrently. * No need to keep the characters in a separate file chars.in; that merely encourages downstream porters to mess with them. * Sort the characters to agree with the mandoc_chars(7) manual page. * Specify Unicode codepoints in hex, not decimal (that's the detail that originally triggered this patch). No functional change, minus 100 LOC, and i don't see a performance change.
* Finally use __progname, err(3) and warn(3).Ingo Schwarze2015-10-111-13/+9
| | | | | | | | | | That's more readable and less error-prone than fumbling around with argv[0], fprintf(3), strerror(3), perror(3), and exit(3). It's a bad idea to boycott good interfaces merely because standards committees ignore them. Instead, let's provide compatibility modules for archaic systems (like commercial Solaris) that still don't have them. The compat module has an UCB Copyright (c) 1993...
* modernize style: "return" is not a functionIngo Schwarze2015-10-061-14/+14
|
* Remove the warning about children of .Vt blocks because actually,Ingo Schwarze2015-09-141-2/+1
| | | | | | | .Vt type global_variable No = Dv defined_constant ; is the best way to specify in the SYNOPSIS how a global variable is initialized in the rare case where that matters. Issue noticed by jmc@.
* Do not fork and exec gunzip(1), just link with libz instead.Ingo Schwarze2015-07-191-83/+33
| | | | | | | As discussed with deraadt@, that's cleaner and will help tame(2). Something like this was also suggested earlier by bapt at FreeBSD. Minus 50 lines of code, deleting one interface function (mparse_wait), no functional change intended.
* Unify some node handling functions that use TOKEN_NONE.Ingo Schwarze2015-04-191-12/+7
| | | | | | | | * mdoc_word_alloc(), man_word_alloc() -> roff_word_alloc() * mdoc_word_append(), man_word_append() -> roff_word_append() * mdoc_addspan(), man_addspan() -> roff_addtbl() * mdoc_addeqn(), man_addeqn() -> roff_addeqn() Minus 50 lines of code, no functional change.
* Decouple the token code for "no request or macro" from the individualIngo Schwarze2015-04-191-6/+5
| | | | | | high-level parsers to allow further unification of functions that only need to recognize this code, but that don't care about different high-level macrosets beyond that.
* Unify {mdoc,man}_{alloc,reset,free}() into roff_man_{alloc,reset,free}().Ingo Schwarze2015-04-181-39/+25
| | | | | Minus 80 lines of code, no functional change. Written on the train from Koeln to Wolfsburg returning from p2k15.
* Move mdoc_hash_init() and man_hash_init() to libmandoc.hIngo Schwarze2015-04-181-3/+9
| | | | | and call them from mparse_alloc() and choose_parser(), preparing unified allocation of struct roff_man.
* Profit from the unified struct roff_man and reduce the number ofIngo Schwarze2015-04-181-52/+40
| | | | | arguments of mparse_result() by one. No functional change. Written on the ICE Bruxelles-Koeln on the way back from p2k15.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-7/+7
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* First step towards parser unification:Ingo Schwarze2015-04-021-5/+6
| | | | | | Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.