summaryrefslogtreecommitdiffstats
path: root/read.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>.
* If a .Bd block has no arguments at all, drop the block and only keepIngo Schwarze2015-10-301-0/+1
| | | | | 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-4/+2
| | | | | | | | | | | | | * 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-12/+8
| | | | | | | | | | 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-13/+13
|
* Remove the warning about children of .Vt blocks because actually,Ingo Schwarze2015-09-141-1/+0
| | | | | | | .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-82/+32
| | | | | | | 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-11/+6
| | | | | | | | * 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-5/+4
| | | | | | 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-38/+24
| | | | | 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-2/+8
| | | | | 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-51/+39
| | | | | 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-6/+6
| | | | | 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-4/+5
| | | | | | 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.
* When the user exits the pager before the pager has drained all inputIngo Schwarze2015-03-171-0/+2
| | | | | | | | from man(1), man(1) dies from SIGPIPE. Exiting man(1) is fine in this case, generating more output would be pointless, but without handling SIGPIPE, the exit code from man(1) was wrong and csh(1) printed an ugly message "Broken pipe". Fix this by handling SIGPIPE explicitly. Issue noticed by deraadt@.
* Fix previous: size_t is often narrower than off_t.Ingo Schwarze2015-03-111-1/+1
| | | | Cluestick applied by joerg at NetBSD.
* The st_size member of struct stat is off_t, which is signed,Ingo Schwarze2015-03-101-1/+1
| | | | | all required by POSIX. So don't compare it against against an unsigned constant.
* If a non-gz manual is read after a gzipped manual, refrainIngo Schwarze2015-03-021-0/+1
| | | | | | from throwing a bogus error "wait: No child processes". As reported by Baptiste Daroussin <bapt at FreeBSD dot org>, clearing the state variable curp->child after use was forgotten.