aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/read.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Clean up eqn(7) error handling:Ingo Schwarze2015-01-281-7/+1
| | | | | | | | * When "define" fails, do not drop the whole equation. * Free memory after "undef". * Use standard mandoc error types instead of rolling our own. * Delete obfuscating EQN_MSG() macro. * Add function prototypes while here.
* * Polish tbl(7) error reporting.Ingo Schwarze2015-01-281-6/+6
| | | | | | * Do not print out macro names in tbl(7) data blocks. * Like with GNU tbl, let empty tables cause a blank line. * Avoid producing empty tables in -Tman.
* Rework tbl(7) layout parsing:Ingo Schwarze2015-01-261-3/+10
| | | | | | | | | | | * Continue parsing even if part of the input is invalid. * Do not require whitespace between cell specifications. * Allow tabs as well as blanks between modifiers. * Mark the 'm' modifier as unsupported. * Parse and ignore the 'p' and 'v' modifiers. * Better warning and error messages. * Get rid of a static buffer. Improved functionality but minus 50 lines of code.
* More improvements regarding tbl(7) options.Ingo Schwarze2015-01-261-1/+2
| | | | | | | | | * Treat "allbox" as an alias for "box" for now. * Parse and ignore the GNU tbl "nowarn" option. * For separation, allow spaces, tabs, and commas only. * Mark eqn(7) within tbl(7) as unsupported. * Simplify the option table. * Improve and sort documentation.
* Improve (or rather, rewrite) tbl(7) option parsing.Ingo Schwarze2015-01-261-3/+5
| | | | | | | | | | | | * Allow the layout to start after the semicolon on the options line. * Ignore leading commas. * Option arguments cannot contain closing parentheses. * Avoid needless UNSUPP messages. * Better ERROR reporting. * Delete unused "linesize" field in struct tbl_opts. * No need for static buffers. * Garbage collect one almost empty wrapper function. Improved functionality, but minus 40 lines of code.
* Support .RE with an argument; needed for audio/pms(1).Ingo Schwarze2015-01-241-1/+2
|
* Traditional roff(7) explicitly allows certain control charactersIngo Schwarze2015-01-221-7/+9
| | | | | | | in the input stream (SOH, STX, ETX, ENQ, ACK, BEL, BS) for specific purposes (leaders, backspace, delimiters, .tr), but making sure these don't leak through to the output is tricky, so mark them as unsupported for now.
* Don't let a failing mparse_open() clobber the filename pointer;Ingo Schwarze2015-01-221-3/+7
| | | | | fixes error message content and a use after free for .so with non-existent target when -Wall or -Tlint is given.
* Split the -Werror message level into -Werror (broken manual, probablyIngo Schwarze2015-01-201-9/+13
| | | | | | | | | | | | | using mandoc is better than using groff) and -Wunsupp (manual using unsupported low-level roff(7) feature, probably using groff is better than using mandoc). Once this feature is complete, it is intended to help porting, making the decision whether to USE_GROFF easier. As a first step, distinguish four classes of roff(7) requests: 1. Supported (currently 24 requests) 2. Currently ignored because unimportant (120) -> no message 3. Ignored for good because insecure (14) -> -Werror 4. Currently unsupported (68) -> these trigger the new -Wunsupp messages
* Fatal errors no longer exist.Ingo Schwarze2015-01-151-41/+12
| | | | | | If a file can be opened, mandoc will produce some output; at worst, the output may be almost empty. Simplifies error handling and frees a message type for future use.
* downgrade .so failure from FATAL to ERRORIngo Schwarze2015-01-151-16/+18
|
* downgrade ".so with absolute path" from FATAL to ERROR;Ingo Schwarze2015-01-141-5/+2
| | | | allows to get rid of ROFF_ERR
* To get rid of SYSERR entries in enum mandocerr, downgrade problems withIngo Schwarze2015-01-141-32/+15
| | | | | | missing and unreadable files from SYSERR to ERROR. Needed for upcoming work. As a bonus, this minimally simplifies code and documentation.
* Simplify handling of system errors: just exit(3).Ingo Schwarze2015-01-141-35/+16
| | | | | We already do the same for malloc(3) failure. The is no virtue in trying to survive failure of fork(2) and the like.
* mdoc(7) already uses the mandoc(1) -Ios argument in the footer lineIngo Schwarze2014-12-281-4/+7
| | | | | | when .Os has no argument, so do the same for man(7) when .TH has less than four arguments; there is no reason to treat both differently. Issue found following a question from Thomas Klausner <wiz at NetBSD>.
* Ignore mdoc(7) and man(7) macros inside tbl(7) code because theyIngo Schwarze2014-12-161-1/+2
| | | | | would abort the table in an unclean way, causing assertion failures found by jsg@.
* The file read.c is part of the parser, so it cannot include main.h,Ingo Schwarze2014-12-011-4/+3
| | | | | | | which is not part of the parser. Besides, the parser *does* modify the input buffer, so marking it "const" in the mparse_readmem() interface is an outright lie. Fix all this by killing the const, the UNCONST, and the bogus inclusion.
* Multiple fixes with respect to .Pf:Ingo Schwarze2014-11-301-1/+2
| | | | | | | * The first argument of .Pf is not parsed. * Normal delimiter handling does not apply to the first argument of .Pf. * Warn if nothing follows a prefix (inspired by groff_mdoc(7)). * In that case, do not suppress spacing.
* warn about attempts to call non-callable macros;Ingo Schwarze2014-11-301-1/+2
| | | | inspired by a similar warning in the groff_mdoc(7) macros
* Drop useless architecture table. Validating architecture namesIngo Schwarze2014-11-281-2/+1
| | | | | | is a job for makewhatis(8)/mandoc.db(5), not for the parser. Removes 150 lines from source files and 4k (1%) from the binary. Bloat found by deraadt@.
* Simplify by making the eqn and tbl steering functions void;Ingo Schwarze2014-11-281-30/+17
| | | | no functional change, minus 15 lines of code.
* Downgrade .Bd -file from FATAL to ERROR.Ingo Schwarze2014-11-271-2/+2
| | | | | Since this was the last remaining FATAL error in this area, this change will allow major simplifications in the mdoc(7) parser.
* Let mparse_readfd() use mparse_open() and mparse_wait()Ingo Schwarze2014-11-261-23/+43
| | | | | | | | and let mparse_open() fall back to .gz files such that .so works even when the target is zipped, requested by and in part using ideas from <bapt at FreeBSD>. While here, make sure files are readable before forking, both for efficiency and for better error reporting.
* Simplify the mparse_open()/mparse_wait() interface.Ingo Schwarze2014-11-261-8/+11
| | | | | Don't bother the user with the PID of the child process, store it inside the opaque mparse handle.
* Use struct buf in libroff, it is very natural thereIngo Schwarze2014-11-011-3/+2
| | | | | | and reduces the number of arguments of many functions. While here, sprinkle some KNF. No functional change.
* Refactor, no functional change: Remove the parse point from struct buf.Ingo Schwarze2014-11-011-38/+32
| | | | | | Some functions need multiple parse points, some none at all, and it varies whether any of them need to be passed around. So better pass them as a separate argument, and only when needed.
* Make the character table available to libroff so it can check theIngo Schwarze2014-10-281-4/+6
| | | | | | | | validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
* integrate preconv(1) into mandoc(1);Ingo Schwarze2014-10-251-20/+53
| | | | enhances functionality and reduces code and docs by more than 300 lines
* Protect the roff parser from dividing by zero. ok schwarze@Kristaps Dzonsons2014-10-201-1/+2
|
* plug file descriptor leaks on read or write failure;Ingo Schwarze2014-10-181-12/+10
| | | | hinted at by Steffen Nurpmeso <sdaoden at yandex dot com>.
* Improve error handling in the eqn(7) parser.Ingo Schwarze2014-10-121-2/+2
| | | | | | | | | | | | | | | | | | | Get rid of the first fatal error, MANDOCERR_EQNSYNT. In eqn(7), there is no need to be bug-compatible with groff, so there is no need to abondon the whole equation in case of a syntax error. In particular: * Skip "back", "delim", "down", "fwd", "gfont", "gsize", "left", "right", "size", and "up" without arguments. * Skip "gsize" and "size" with a non-numeric argument. * Skip closing delimiters that are not open. * Skip "above" outside piles. * For diacritic marks and binary operators without a left operand, default to an empty box. * Let piles and matrices take one argument rather than insisting on a braced list. Let HTML output handle that, too. * When rewinding, if the root box is guaranteed to match the termination condition, no error handling is needed.
* warn about parentheses in function names after .Fn and .Fo;Ingo Schwarze2014-10-111-1/+2
| | | | | particularly useful when converting from other languages to mdoc(7); feature suggested by bentley@
* warn about commas in function arguments; inspired by mdoclint(1)Ingo Schwarze2014-09-121-1/+2
|
* warn about botched .Xr ordering and punctuation below SEE ALSO;Ingo Schwarze2014-09-111-1/+3
| | | | inspired by mdoclint(1)
* warn about AUTHORS sections without .An macros, inspired by mdoclint(1)Ingo Schwarze2014-09-071-1/+2
|
* always use the right buffer, and fix one evil typoIngo Schwarze2014-09-071-2/+5
|
* Simplify by handling empty request lines at the one logical placeIngo Schwarze2014-09-061-16/+5
| | | | | in the roff parser instead of in three other places in other parsers. No functional change.
* Move main format autodetection from the parser dispatcher to theIngo Schwarze2014-09-061-27/+42
| | | | | | | | | | | roff parser where .Dd and .TH are already detected, anyway. This improves robustness because it correctly handles whitespace or an alternate control character before Dd. In the parser dispatcher, provide a fallback looking ahead in the input buffer instead of always assuming man(7). This corrects autodetection when Dd is preceded by other macros or macro-like handled requests like .ll. Triggered by reports from Daniel Levai about issues on Slackware Linux.
* Add *.gz support to apropos(1) -a, man(1), and even mandoc(1).Ingo Schwarze2014-09-031-3/+96
| | | | Implemented by moving the zip code from makewhatis(8) to the parser lib.
* Improve build system and autodetection.Ingo Schwarze2014-08-161-4/+4
| | | | | | | | | * Make ./configure standalone, that's what people expect. * Let people write a ./configure.local from scratch, not edit existing files. * Autodetect wchar, sqlite3, and manpath and act accordingly. * Autodetect the need for -L/usr/local/lib and -lutil. * Get rid of config.h.p{re,ost}, let ./configure only write what's needed. * Let ./configure write a Makefile.local snippet, that's quite flexible.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-5/+4
| | | | | | Include <sys/types.h> where needed, it does not belong in config.h. Remove <stdio.h> from config.h; if it is missing somewhere, it should be added, but i cannot find a *.c file where it is missing.
* Bring the handling of defective prologues even closer to groff,Ingo Schwarze2014-08-061-5/+8
| | | | | | | | | | | | in particular relaxing the distinction between prologue and body and further improving messages. * The last .Dd wins and the last .Os wins, even in the body. * The last .Dt before the first body macro wins. * Missing title in .Dt defaults to UNTITLED. Warn about it. * Missing section in .Dt does not default to 1. But warn about it. * Do not warn multiple times about the same mdoc(7) prologue macro. * Warn about missing .Os. * Incomplete .TH defaults to empty strings. Warn about it.
* mention requests and macros in more messagesIngo Schwarze2014-08-011-9/+9
|
* Dynamically allocate the stack of roff(7) .ie condition valuesIngo Schwarze2014-08-011-2/+1
| | | | and thus get rid of the last useless fatal error.
* Split MANDOCERR_IGNARGV into one message for .An and one for .BlIngo Schwarze2014-07-311-2/+3
| | | | and report the macro name and argument.
* In .Bl -column, if some of the column width declarations are givenIngo Schwarze2014-07-311-2/+1
| | | | | | | | | | | | | right after the -column argument and some at the very end of the argument list, after some other arguments like -compact, concatenate the column lists. This gets rid of one of the last useless FATAL errors and actually shortens the code by a few lines. This fixes an issue introduced more than five years ago, at first causing an assert() since mdoc_action.c rev. 1.14 (June 17, 2009), then later a FATAL error since mdoc_validate rev. 1.130 (Nov. 30, 2010), and marked as "TODO" ever since.
* Remove the useless FATAL error "argument count wrong, violates syntax".Ingo Schwarze2014-07-301-2/+1
| | | | | | The last remaining instance was .It in .Bl -column with more than one excessive .Ta. However, simply downgrading from FATAL to ERROR, it just works fine, almost the same way as in groff, without any other changes.
* Get rid of the useless FATAL error "child violates parent syntax".Ingo Schwarze2014-07-301-2/+2
| | | | | When finding items outside lists, simply skip them and throw an ERROR. Handle subsections before the first section instead of bailing out.
* Remove two useless FATAL errors.Ingo Schwarze2014-07-301-18/+22
| | | | | When a file contains neither text nor macros, treat it as an empty document. When the mdoc(7) document prologue is incomplete, use some default values.
* better name and wording for the last two non-generic errorsIngo Schwarze2014-07-301-4/+4
|