aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man_macro.c
Commit message (Collapse)AuthorAgeFilesLines
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-281-87/+54
| | | | and some cleanup; no functional change, minus 70 lines.
* Allow the five man(7) font macros to concatenate their line arguments,Ingo Schwarze2014-11-031-8/+11
| | | | | | | the same way the mdoc(7) macros marked MDOC_JOIN do it. In -Thtml, this removes bogus <br/> when the font macros are used in no-fill mode; issue found by jsg@ in the Xcursor(3) SYNOPSIS. As a bonus, this slightly reduces the size of the syntax tree.
* When the first child of the node being validated gets deleted duringIngo Schwarze2014-08-181-2/+13
| | | | | | | | | | | | | | | validation, man_node_unlink() switches to MAN_NEXT_CHILD. After that, we have to switch back to MAN_NEXT_SIBLING after completing validation, or subsequent parsing would add content into an already closed node, clobbering potentially existing children, causing information loss and a memory leak. Bug found by kristaps@ with valgrind in groff(7) on Mac OS X. Note that the switch back must be conditional, for if the node being validated itself gets deleted, we must *not* go to MAN_NEXT_SIBLING, which would not only yield wrong results in general but also crash in malformed manuals having an empty paragraph before the first .SH, for example OpenBSD c++filt(1).
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-3/+3
| | | | | | 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.
* Improve handling of next-line scope broken by end of file.Ingo Schwarze2014-07-301-8/+30
| | | | | | Detect the condition earlier, report in the error message which block is broken, and delete the broken block. Consequently, empty section headers can no longer happen.
* garbage collect three unused global flags; no functional changeIngo Schwarze2014-07-301-8/+1
|
* delete forgotten, obsolete rew_warn() prototypeIngo Schwarze2014-07-091-3/+1
|
* Clean up ERROR messages related to document structure and macros:Ingo Schwarze2014-07-071-3/+4
| | | | Hierarchical naming and mention macro names in messages.
* Simplify man_unscope(), removing 18 lines of code, that is,Ingo Schwarze2014-07-071-46/+22
| | | | | | removing one function argument, one function definition, three function invocations and two pointless assert()s. No functional change.
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-37/+23
| | | | | remove trailing whitespace and blanks before tabs, improve some indenting; no functional change
* Implement the roff(7) .ll (line length) request.Ingo Schwarze2014-03-301-1/+2
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* Simplify: Remove an unused argument from the mandoc_eos() function.Ingo Schwarze2013-12-311-2/+2
| | | | No functional change.
* s/[Nn]ull/NUL/ in comments where appropriate;Ingo Schwarze2013-12-251-1/+2
| | | | suggested by Thomas Klausner <wiz @ NetBSD dot org>.
* Implement end-of-sentence spacing at the end of man(7) macro lines.Ingo Schwarze2013-12-221-1/+10
| | | | Patch from Franco Fichtner <franco at lastsummer dot de> (DragonFly).
* In the parser, when closing an explicit block that is not open,Ingo Schwarze2013-11-111-5/+7
| | | | | | | | 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.
* Implement the .UR/.UE block (uniform resource identifier) introduced in theIngo Schwarze2013-10-171-1/+6
| | | | | | | | 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.
* Cleanup naming of local variables to make the code easier on the eye:Ingo Schwarze2012-11-171-61/+61
| | | | | | | | Settle for "struct man *man", "struct mdoc *mdoc", "struct meta *meta" and avoid the confusing "*m" which was sometimes this, sometimes that. No functional change. ok kristaps@ some time ago
* Fix an assert() raised by `RS' when following `TP'.Kristaps Dzonsons2012-06-121-2/+2
| | | | | | The reason was that `RS' wasn't BSCOPE'd, so the next-line (BLINE) scope opened by `TP' would still be in the HEAD macro. This was from joerg@'s archive of failures.
* Close a preceding implicit block before opening an explicit block.Ingo Schwarze2012-06-031-17/+29
| | | | | | | | To allow doing so, no longer abuse rew_scope() to unwind explicit blocks; explicitly call man_unscope() instead. Fixing the indentation of slapd.conf(5) in the OpenLDAP port; thanks to guenther@ for the report.
* Minimal implementation of .EX and .EE for GNU compatibility.Ingo Schwarze2012-06-021-1/+3
| | | | | Do not use this, it is not portable and only defined in esr's man-ext. For example, sox(1) wants these macros.
* Add support for `OP', one of the extended man macros. This also requiresKristaps Dzonsons2012-01-031-1/+2
| | | | some man(7) changes to accomodate for the an-ext compatibility.
* Jumping out of man_unscope() for the root node is a bad ideaIngo Schwarze2011-12-041-3/+1
| | | | | | | | because that will skip root node validation, potentially entering rendering modules will NULL pointers lurking in the meta data. Instead, always validate the root node and (as suggested by joerg@) assert validity of the meta data before using it in the renderers. ok joerg@
* Fix condition. Not enough tea.Joerg Sonnenberger2011-11-181-2/+2
|
* Slightly adjust last: return successful as some times the correct errorJoerg Sonnenberger2011-11-181-2/+2
| | | | is raised later.
* Convert an assert into an explicit check. man_unscope can be triggeredJoerg Sonnenberger2011-11-181-2/+3
| | | | on unknown macros.
* When the HEAD scope of .TP is broken by another block macro,Ingo Schwarze2011-11-071-12/+12
| | | | | | | | do not abort with a FATAL error, but report a report a WARNING, remove the broken .TP from the syntax tree, and prod on. Reported repeatedly by ports people, at least by brad@ and jeremy@. Also fixes rendition(4) in Xenocara. ok kristaps@
* forgotten Copyright bumps; no code changeIngo Schwarze2011-09-181-2/+2
| | | | found while syncing to OpenBSD
* Fix a bug in the -man parser where deleting nodes (such as `PP' or `LP'Kristaps Dzonsons2011-07-071-7/+7
| | | | | | in certain situations) caused the next macros to be assigned as siblings instead of child nodes to the original parent. Noticed and ok by schwarze@.
* Allow RS/RE blocks to nest. This requires first the syntax tree toKristaps Dzonsons2011-06-181-6/+1
| | | | | | | | accomodate for the fix, then for the front-ends. -T[x]html accepted the syntax tree natively, but -Tascii had to use relative offsets. It's quite a simple fix. From a TODO by {dcoppa,dsoares}@openbsd.
* Clean up parsing of delimiters in -mdoc. First, remove the "dowarn"Kristaps Dzonsons2011-04-191-2/+2
| | | | | | | | variable from mandoc_getarg() so that it prints the warning every time. Then, remove the warning from args_checkpunct(). This way, warnings are being posted at the correct time. This makes the flag argument to mdoc_zargs() superfluous, so make it be zero when it's invoked. Finally, move the args() flags into mdoc_argv.c and make them enums.
* Get mdoc_argv.c ready to use [some of] mandoc_getarg() by giving saidKristaps Dzonsons2011-04-171-2/+2
| | | | function a parameter to suppress warnings.
* Merge man_args() into man_macro.c, the only place where it's called, andKristaps Dzonsons2011-03-231-4/+21
| | | | | | make its return value boolean (we don't care about QWORD). We can move it into mdoc_macro.c because it's basically just a wrapper around mandoc_getarg(). Then blow away man_argv.c, which is left empty.
* First, make -man ARGS_EOLN et al. be an enum. Second, removeKristaps Dzonsons2011-03-231-21/+7
| | | | | ARGS_ERROR, as it is never returned by man_args(). Then clean up invocations of man_args() to only check for ARGS_EOLN.
* libmdoc.h and libman.h were including mdoc.h and man.h, respectively.Kristaps Dzonsons2011-03-221-1/+2
| | | | | Don't have them do that (includes in header files = faugh), and have individual files directly include these files.
* Consolidate messages. Have all parse-time messages (in libmdoc,Kristaps Dzonsons2011-03-201-1/+2
| | | | | | | | | libroff, etc., etc.) route into mandoc_msg() and mandoc_vmsg(), for the time being in libmandoc.h. This requires struct mparse to be passed into the allocation routines instead of mandocmsg and a void pointer. Then, move some of the functionality of the old mmsg() into read.c's mparse_mmsg() (check against wlevel and setting of file_status) and use main.c's mmsg() as simply a printing tool.
* Clean-up in libman: make all calls to man_*msg not check return value.Kristaps Dzonsons2011-03-171-13/+12
| | | | Also convert man_vmsg to return void.
* Downgrade -man message of ignored empty paragraph to MANDOC_IGNPAR. TheKristaps Dzonsons2011-01-121-5/+13
| | | | | | | | | | | change in man_macro.c was from an assertion caused by a subtle problem: (1) macro is removed, causing m->last to be m->last->parent; (2) by jumping to the m->last->parent after post-validation, the original m->last->parent is skipped; (3) the rewinder climbs to the root of the tree and aborts. The original issue recorded in the TODO by schwarze@, reminded by Brad Smith.
* Remove `i' and `r' macro handlers. These macros, originally part of theKristaps Dzonsons2010-12-081-3/+1
| | | | | | | | me package, aren't recognised by "groff -mandoc" so we don't need to do so either. Discussed on tech@ with schwarze@. While at it, remove references to `b' in man.7. As far as I know, this was never supported anyway.
* Add support for `ft' macro found in groff(7). Based on a patch byKristaps Dzonsons2010-12-061-1/+2
| | | | | schwarze@, but without the -T[x]html handling, which structurally does not work. Also add man.7 documentation (not in original patch).
* Remove `Sp', `Vb', and `Ve' (as per schwarze@'s changes in OpenBSD),Kristaps Dzonsons2010-12-051-4/+1
| | | | which are now accomodated for the new libroff modifications.
* Kill man_action.c.Kristaps Dzonsons2010-11-301-9/+1
|
* Sync to OpenBSD: add missing Copyright years.Ingo Schwarze2010-07-311-2/+2
| | | | | I checked that substantial changes were committed to these files during these years.
* Added `in' macro support for -man -Tascii. This is not yet supported inKristaps Dzonsons2010-07-221-1/+2
| | | | -Thtml (I'm surprised to note that neither is LITERAL mode).
* Mechanical diff allowing the const struct regset to propogate throughKristaps Dzonsons2010-06-261-1/+4
| | | | libman and libmdoc.
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-2/+2
|
* Enable the unified error/warning enumeration in mandoc.h that'sKristaps Dzonsons2010-05-171-11/+13
| | | | | | | | | | | stringified in main.c. Allow `An' to handle an argument and child (with a warning). Allow `Rv' and `Ex' to work without a prior `Nm' as groff does (with a warning). Allow inconsistent column syntax to only raise a warning.
* Add support for .AT. Properly implement .UC. Add regress tests.Joerg Sonnenberger2010-05-171-1/+2
|
* Remove `am', `ami', `de', `dei', and `.' from -man, as they're now in the ↵Kristaps Dzonsons2010-05-151-91/+5
| | | | roff preprocessor.
* Pull `ig' out of -man and leave it the roff preparser.Kristaps Dzonsons2010-05-151-4/+2
|
* Final (?) fix to issue pointed out by Sascha Wildner: roff instructions ↵Kristaps Dzonsons2010-03-291-20/+10
| | | | clobbering prior scope rules and line modes.