summaryrefslogtreecommitdiffstats
path: root/man_macro.c
Commit message (Collapse)AuthorAgeFilesLines
...
* preserve .PP before .RE; effect found in audio/pms(1)Ingo Schwarze2015-01-241-1/+12
|
* Strangely, ignoring the roff(7) .na request was implemented in the man(7)Ingo Schwarze2015-01-241-1/+0
| | | | | parser. Simplify the code by moving it into the roff(7) parser, also making it work for mdoc(7).
* Support .RE with an argument; needed for audio/pms(1).Ingo Schwarze2015-01-241-2/+22
|
* Explicit block closure macros clobber next-line block head scope,Ingo Schwarze2014-12-161-2/+2
| | | | | just like explicit block macros themselves. Fixing an assertion failure jsg@ found with afl.
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-281-86/+53
| | | | 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-7/+10
| | | | | | | 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-1/+12
| | | | | | | | | | | | | | | 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-2/+2
| | | | | | 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-7/+29
| | | | | | 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-7/+0
|
* delete forgotten, obsolete rew_warn() prototypeIngo Schwarze2014-07-091-2/+0
|
* Clean up ERROR messages related to document structure and macros:Ingo Schwarze2014-07-071-2/+3
| | | | Hierarchical naming and mention macro names in messages.
* Simplify man_unscope(), removing 18 lines of code, that is,Ingo Schwarze2014-07-071-45/+21
| | | | | | 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-36/+22
| | | | | 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-0/+1
| | | | | 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-1/+1
| | | | No functional change.
* s/[Nn]ull/NUL/ in comments where appropriate;Ingo Schwarze2013-12-251-0/+1
| | | | 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-0/+9
| | | | 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-4/+6
| | | | | | | | 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-0/+5
| | | | | | | | 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-60/+60
| | | | | | | | 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-1/+1
| | | | | | 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-16/+28
| | | | | | | | 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-0/+2
| | | | | 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-0/+1
| | | | 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-2/+0
| | | | | | | | 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-1/+1
|
* Slightly adjust last: return successful as some times the correct errorJoerg Sonnenberger2011-11-181-1/+1
| | | | is raised later.
* Convert an assert into an explicit check. man_unscope can be triggeredJoerg Sonnenberger2011-11-181-1/+2
| | | | on unknown macros.
* When the HEAD scope of .TP is broken by another block macro,Ingo Schwarze2011-11-071-11/+11
| | | | | | | | 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-1/+1
| | | | found while syncing to OpenBSD
* Fix a bug in the -man parser where deleting nodes (such as `PP' or `LP'Kristaps Dzonsons2011-07-071-6/+6
| | | | | | 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-5/+0
| | | | | | | | 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-1/+1
| | | | | | | | 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-1/+1
| | | | function a parameter to suppress warnings.
* Merge man_args() into man_macro.c, the only place where it's called, andKristaps Dzonsons2011-03-231-3/+20
| | | | | | 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-20/+6
| | | | | 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-0/+1
| | | | | 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-0/+1
| | | | | | | | | 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-12/+11
| | | | Also convert man_vmsg to return void.
* Downgrade -man message of ignored empty paragraph to MANDOC_IGNPAR. TheKristaps Dzonsons2011-01-121-4/+12
| | | | | | | | | | | 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-2/+0
| | | | | | | | 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-0/+1
| | | | | 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-3/+0
| | | | which are now accomodated for the new libroff modifications.
* Kill man_action.c.Kristaps Dzonsons2010-11-301-8/+0
|
* Sync to OpenBSD: add missing Copyright years.Ingo Schwarze2010-07-311-1/+1
| | | | | 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-0/+1
| | | | -Thtml (I'm surprised to note that neither is LITERAL mode).
* Mechanical diff allowing the const struct regset to propogate throughKristaps Dzonsons2010-06-261-0/+3
| | | | libman and libmdoc.
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-1/+1
|
* Enable the unified error/warning enumeration in mandoc.h that'sKristaps Dzonsons2010-05-171-10/+12
| | | | | | | | | | | 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.