summaryrefslogtreecommitdiffstats
path: root/man.c
Commit message (Collapse)AuthorAgeFilesLines
* Simplify by making the eqn and tbl steering functions void;Ingo Schwarze2014-11-281-4/+2
| | | | no functional change, minus 15 lines of code.
* Simplify by making many functions in the man(7) parser void,Ingo Schwarze2014-11-281-117/+69
| | | | and some cleanup; no functional change, minus 70 lines.
* Escape sequences terminate high-level macro names, and when doing so,Ingo Schwarze2014-11-191-6/+21
| | | | | | they are ignored, just in the same way as for request names and for low-level macro names. This also cures a warning in the pod2man(1) preamble.
* Allow the five man(7) font macros to concatenate their line arguments,Ingo Schwarze2014-11-031-0/+15
| | | | | | | 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.
* correct the spacing after in-line equationsIngo Schwarze2014-10-201-1/+2
| | | | | that start at the beginning of an input line but end before the end of an input line
* correct spacing before inline equationsIngo Schwarze2014-10-201-0/+2
|
* Simplify by handling empty request lines at the one logical placeIngo Schwarze2014-09-061-7/+0
| | | | | in the roff parser instead of in three other places in other parsers. No functional change.
* Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.Ingo Schwarze2014-08-101-2/+0
| | | | | | 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.
* Simplify man(7) validation:Ingo Schwarze2014-08-011-3/+4
| | | | | | | | | Drop pre-handlers, they were almost unused. Drop the needless complexity of allowing more than one post-handler. This saves one internal interface function, one static function, one private struct definition, sixteen static arrays, and 45 lines of code. No functional change.
* mention requests and macros in more messagesIngo Schwarze2014-08-011-2/+2
|
* garbage collect three unused global flags; no functional changeIngo Schwarze2014-07-301-44/+7
|
* Simplify: replace one global flag by one local variable.Ingo Schwarze2014-07-301-11/+6
| | | | No functional change.
* Clean up ERROR messages related to document structure and macros:Ingo Schwarze2014-07-071-2/+2
| | | | Hierarchical naming and mention macro names in messages.
* Simplify man_unscope(), removing 18 lines of code, that is,Ingo Schwarze2014-07-071-3/+3
| | | | | | removing one function argument, one function definition, three function invocations and two pointless assert()s. No functional change.
* Clean up messages related to plain text and to escape sequences.Ingo Schwarze2014-07-061-3/+6
| | | | | * Mention invalid escape sequences and string names, and fallbacks. * Hierarchical naming.
* Do not segfault in makewhatis -Q if the next .SH after .SH NAMEIngo Schwarze2014-05-071-3/+6
| | | | does not have any arguments. Crash found by nigel@ in kermit(1).
* KNF: case (FOO): -> case FOO:, remove /* LINTED */ and /* ARGSUSED */,Ingo Schwarze2014-04-201-45/+29
| | | | | 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/+1
| | | | | Found by naddy@ in the textproc/enchant(1) port. Of course, do not use this in new manuals.
* Skip leading escape sequences in man_deroff(). Helps indexing ofIngo Schwarze2014-03-231-4/+11
| | | | some manuals containing overzealous escaping in their NAME section.
* If a man(7) NAME section contains macros, avoid truncated or emptyIngo Schwarze2014-03-231-0/+40
| | | | | | entries for .Nd in mandocdb(8), instead use the macro content recursively. This improves indexing of more than 200 manuals in Xenocara, i.e. more than 15%, in particular GL and some Xkb.
* The files mandoc.c and mandoc.h contained both specialised low-levelIngo Schwarze2014-03-231-0/+1
| | | | | | | functions used for multiple languages (mdoc, man, roff), for example mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary functions. Split the auxiliaries out into their own file and header. While here, do some #include cleanup.
* Joerg Sonnenberger contributed copyrightable amounts of text toIngo Schwarze2014-01-061-0/+1
| | | | | | some files. To make it clear that he also put his contributions under the ISC license, with his explicit permission, add his Copyright notice to the relevant files. No code change.
* Add an option -Q (quick) to mandocdb(8)Ingo Schwarze2014-01-051-1/+9
| | | | | | | | | | | | | | | for accelerated generation of reduced-size databases. Implement this by allowing the parsers to optionally abort the parse sequence after the NAME section. While here, garbage collect the unused void *arg attribute of struct mparse and mparse_alloc() and fix some errors in mandoc(3). This reduces the processing time of mandocdb(8) on /usr/share/man by a factor of 2 and the database size by a factor of 4. However, it still takes 5 times the time and 6 times the space of makewhatis(8), so more work is clearly needed.
* Simplify: Remove an unused argument from the mandoc_eos() function.Ingo Schwarze2013-12-311-1/+1
| | | | No functional change.
* Ignore blank lines right after .SH and .SS.Ingo Schwarze2013-11-101-5/+11
| | | | Improves the rendering of gpg(1); issue reported by jca on ports.
* Implement the .UR/.UE block (uniform resource identifier) introduced in theIngo Schwarze2013-10-171-1/+2
| | | | | | | | 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-125/+125
| | | | | | | | 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
* Translate blank input lines to .sp just like in mdoc(7),Ingo Schwarze2012-07-141-2/+3
| | | | | | and ignore .sp after .PP. This fixes vertical spacing for blank lines after .PP and for .sp after .PP. OpenBSD rev. man.c 1.68 and man_term.c 1.86
* Add `cc' support.Kristaps Dzonsons2012-06-121-1/+1
| | | | | | | | | | | | | | | This was reported by espie@ and in the TODO. Caveat: `cc' has buggy behaviour when invoked in groff(1) and followed by a line-breaking control character macro, e.g., in a -man doc, .cc | .B foo 'B foo |cc 'B foo will cause groff(1) to behave properly for `.B' but inline the macro definition for `B' when invoked with the line-breaking macro.
* Minimal implementation of .EX and .EE for GNU compatibility.Ingo Schwarze2012-06-021-1/+1
| | | | | 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/+1
| | | | some man(7) changes to accomodate for the an-ext compatibility.
* Correctly handle constructs likeJoerg Sonnenberger2011-11-161-2/+7
| | | | | .TP 8 .SH foo
* When the HEAD scope of .TP is broken by another block macro,Ingo Schwarze2011-11-071-1/+28
| | | | | | | | 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@
* If -Tman is specified and input is -man, echo the preprocessed (`so'Kristaps Dzonsons2011-10-061-0/+8
| | | | | | | | | | | | | | replaced by file) input. This replaces earlier behaviour of doing nothing, which I found unexpected (mandoc should always output). This requires a buffer in read.c that saves the input lines before being parsed, with a special hook if `so' is invoked. This buffer is just flushed to output if -mman is the input. While mucking around doing this, I also alpha-ordered the mandoc.h functions. Ok schwarze@, with no screaming when the polished patch was published.
* An implementation of `tr'. This routes allocations of TEXT nodesKristaps Dzonsons2011-07-281-1/+1
| | | | | | | through libroff, which does the appropriate translations of `tr'. This is SLOW: it uses the backend of `ds' and `de', which is a simple linear list. However, unlike `ds' and `de', it iterates over EACH CHARACTER of the entire file looking for replacements.
* Simply word allocation in libmdoc and libman.Kristaps Dzonsons2011-07-271-8/+1
|
* Finish the eqn syntactic parser. This correctly parses terms and doesKristaps Dzonsons2011-07-211-2/+2
| | | | | | | the proper `define' dance, which amounts to pure word-replace (you can, say, define `foo' as `define' then define `define' as something else). eqn.c is now ready for some semantic parsing of `box' and `eqn' productions as defined by the grammar.
* Make `struct roff' be passed into libmdoc and libman upon creation.Kristaps Dzonsons2011-07-181-2/+2
| | | | | This is required for supporting in-line equations. While here, push registers properly into roff and add an set/get/mod interface.
* Make libman use mandoc_getcontrol() for real this time.Kristaps Dzonsons2011-03-291-46/+22
|
* Add MAN_TAIL, which will be used by `UE' (forthcoming) and needs to beKristaps Dzonsons2011-03-231-0/+17
| | | | used for `RE'.
* 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-21/+6
| | | | | | | | | 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-2/+2
| | | | Also convert man_vmsg to return void.
* Clean up date handling,Ingo Schwarze2011-03-071-3/+3
| | | | | | | | | | | | as a first step to get rid of the frequent petty warnings in this area: - always store dates as strings, not as seconds since the Epoch - for input, try the three most common formats everywhere - for unrecognized format, just pass the date though verbatim - when there is no date at all, still use the current date Originally triggered by a one-line patch from Tim van der Molen, <tbvdm at xs4all dot nl>, which is included here. Feedback and OK on manual parts from jmc@. "please check this in" kristaps@
* Allow -man to process EQN as well. Also fix a segfault in missing caseKristaps Dzonsons2011-02-091-0/+16
| | | | statements in the post-handler for EQN in -mdoc and -man.
* Put tbl_alloc function right into the addspan() one, as this is the onlyKristaps Dzonsons2011-02-081-18/+8
| | | | place that it's called.
* Use tbl_span line number for warnings/errors.Kristaps Dzonsons2011-02-061-1/+1
|
* Let the line-number of a tbl_span be remembered.Kristaps Dzonsons2011-02-061-2/+1
|
* If the first character of free-form text is whitespace, then a newlineKristaps Dzonsons2011-01-121-8/+15
| | | | shall precede outputted text (surprise!).
* Same treatment for MAN_HALT as for MDOC_HALT.Kristaps Dzonsons2011-01-031-9/+9
|