summaryrefslogtreecommitdiffstats
path: root/man_validate.c
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup naming of local variables to make the code easier on the eye:Ingo Schwarze2012-11-171-80/+71
| | | | | | | | 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
* Implement .PD for -Tascii.Ingo Schwarze2012-07-291-1/+2
| | | | | | Reminded about the missing feature by millert@. This reduces mandoc/groff differences in OpenBSD base by 25%. ok millert@
* Drop empty .IP such that is does not cause additional vertical spacing.Ingo Schwarze2012-07-181-1/+21
| | | | | Issue first reported by naddy@ in rsync(1). OpenBSD rev. 1.55.
* Drop .sp and .br right after .SH and .SS.Ingo Schwarze2012-07-181-6/+19
| | | | | | | Fixes vertical spacing after "OPTIONS" in gcc(1). Issue first reported by naddy@ in rsync(1). OpenBSD rev. 1.54.
* 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-2/+6
| | | | some man(7) changes to accomodate for the an-ext compatibility.
* In man(7), when no explicit volume name is given, use the defaultIngo Schwarze2011-12-021-0/+4
| | | | | | | | | | | | volume name for the respective manual section, just like in mdoc(7). This gives us nicer page headers for cvs(1), lynx(1), tic(1), mkhybrid(8), and many curses(3) manuals. ok kristaps@ To not break compatibility, i wrote a corresponding patch for GNU troff which Werner Lemberg accepted upstream at rev. 1.65 of: http://cvs.savannah.gnu.org/viewvc/groff/tmac/an-old.tmac?root=groff
* When the HEAD scope of .TP is broken by another block macro,Ingo Schwarze2011-11-071-25/+10
| | | | | | | | 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@
* When .TH sets no data, leave the date field in the page footer blank,Ingo Schwarze2011-11-031-3/+5
| | | | | | do not use the current date. This removes a gratuitous output difference with respect to groff. ok kristaps@
* Remove a bunch of useless assignments,Ingo Schwarze2011-10-161-6/+5
| | | | | | | and assert that print_bvspace cannot be called on NULL pointers. No change in behaviour, none of these were bugs, but the code becomes easier to understand. Based on a clang report posted by joerg@; ok kristaps@.
* Revert removal of tab warning, suggested by schwarze@.Kristaps Dzonsons2011-09-061-2/+17
|
* Remove check for tab. man(7) says tab is Ok.Kristaps Dzonsons2011-09-041-17/+2
|
* Teach -man that a literal context should be closed by SS/SH in theKristaps Dzonsons2011-09-041-9/+19
| | | | | backend (the front-end already accomodated for this). Found indirectly from a question by Brad Smith.
* Move checking of escapes into roff.c, where we're already steppingKristaps Dzonsons2011-07-261-36/+6
| | | | | through looking for user-defined escapes. This clears up a nice bit of validation code.
* Scary-looking but otherwise harmless changes allow me to build for Windows.Kristaps Dzonsons2011-07-241-1/+2
| | | | | | | | | | | | That is to say, with mingw32. This amounts to the following: (1) break compat.c into compat_strlcpy.c and compat_strlcat.c (2) add compat_getsubopt.c (from OpenBSD) and test-getsubopt.c (3) add test-strptime.c for HAVE_STRPTIME (4) add ifdef bits here and there, where necessary (5) remove some harmless unportable stuff (u_char, localtime_r) I've added the appropriate mdocml.zip target to the Makefile, too.
* Make sure that `br' and `sp' don't emit space before the initial `SH' inKristaps Dzonsons2011-07-081-4/+19
| | | | | | -man. This actually seems to be what groff does. Sort-of. Anyway, it's required to get perlpod pages rendered nicely, so until perlpod stops producing shit, do it. Ok schwarze@.
* Remove the warning for empty bodies of `Sh', `Ss', `SH', and `SS'. ThisKristaps Dzonsons2011-04-131-7/+4
| | | | | | | | | | | prompted by a TODO by schwarze@, originally from Gleydson Soares, that an empty `SS' was raising an error (it hasn't for some time). It makes sense these shouldn't warn, as omitting their contents doesn't change anything in the structure of the document (groff and mandoc specifically account for the whitespace between empty sections). This doesn't change any manuals, which only refer to the line arguments (or possibly next-line, in the case of man(7) syntax).
* Remove a2roffdeco() and mandoc_special() functions and replace them withKristaps Dzonsons2011-04-091-24/+30
| | | | | | | | | | | | | | | | | | a public (mandoc.h) function mandoc_escape(), which merges the functionality of both prior functions. Reason: code duplication. The a2roffdeco() and mandoc_special() functions were pretty much the same thing and both quite complex. This allows one function to receive improvements in (e.g.) subexpression handling and performance, instead of having to replicate functionality. As such, the mandoc_escape() function already handles a superset of the escapes handled in previous versions and has improvements in performance (using strcspn(), for example) and reliable handling of subexpressions. This code Works For Me, but may need work to catch any regressions. Since the benefits are great (leaner code, simpler API), I'd rather have it in-tree than floating as a patch.
* Make empty sections and parts (SH, SS, RS) only produce a warning if itKristaps Dzonsons2011-03-221-2/+4
| | | | has no children. Noted by Brad, added to TODO by schwarze@.
* 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-9/+12
| | | | | | | | | 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-3/+2
| | | | Also convert man_vmsg to return void.
* Clean up date handling,Ingo Schwarze2011-03-071-23/+15
| | | | | | | | | | | | 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/+2
| | | | statements in the post-handler for EQN in -mdoc and -man.
* Add initial libmdoc and libman top-most machinery for accepting TBLKristaps Dzonsons2011-02-061-0/+2
| | | | | directives. For now this will just ignore them (except for -Ttree, which just notes that an EQN's been accepted).
* Refrain from throwing fatal errors forIngo Schwarze2011-01-171-33/+23
| | | | | | | * .br .sp .nf .fi .na with arguments - just skip the arguments * .TH lacking arguments - use empty strings instead like groff * .TH with excessive arguments - skip those Reminded by joerg@, ok kristaps@.
* Downgrade -man message of ignored empty paragraph to MANDOC_IGNPAR. TheKristaps Dzonsons2011-01-121-30/+19
| | | | | | | | | | | 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.
* Make out-of-context `fi' invocations not cause an error, but just aKristaps Dzonsons2011-01-121-1/+1
| | | | warning. From a TODO by schwarze@, originally noted by Brad Smith.
* Add -man support for tables. Like -mdoc, this consists of anKristaps Dzonsons2011-01-011-3/+11
| | | | | | | external-facing function man_addspan() (this required shuffling around the descope routine) and hooks elsewhere. Also fixed mdoc.c's post-validation of tables.
* 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/+55
| | | | | schwarze@, but without the -T[x]html handling, which structurally does not work. Also add man.7 documentation (not in original patch).
* Make return(man_nmsg(...)) by a simple declaration.Kristaps Dzonsons2010-12-061-18/+20
| | | | | | Make non-uppercase warning only occur once. Make scope-open-on-error warning only occur once.
* Allow HP/IP/etc. to have no arguments, as they're optional. From a field-Kristaps Dzonsons2010-12-061-3/+1
| | | | tested patch by schwarze@.
* Remove `Sp', `Vb', and `Ve' (as per schwarze@'s changes in OpenBSD),Kristaps Dzonsons2010-12-051-4/+0
| | | | which are now accomodated for the new libroff modifications.
* Move all man_action.c routines into man_validate.cKristaps Dzonsons2010-11-301-8/+191
|
* Quiesce Linux header-inclusion warnings.Kristaps Dzonsons2010-10-111-0/+1
|
* Implement a simple, consistent user interface for error handling.Ingo Schwarze2010-08-201-6/+2
| | | | | | | | | | | | | | | | | We now have sufficient practical experience to know what we want, so this is intended to be final: - provide -Wlevel (warning, error or fatal) to select what you care about - provide -Wstop to stop after parsing a file with warnings you care about - provide consistent exit status codes for those warnings you care about - fully document what warnings, errors and fatal errors mean - remove all other cruft from the user interface, less is more: - remove all -f knobs along with the whole -f option - remove the old -Werror because calling warnings "fatal" is silly - always finish parsing each file, unless fatal errors prevent that This commit also includes a couple of related simplifications behind the scenes regarding error handling. Feedback and OK kristaps@; Joerg Sonnenberger (NetBSD) and Sascha Wildner (DragonFly BSD) agree with the general direction.
* 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-4/+5
| | | | -Thtml (I'm surprised to note that neither is LITERAL mode).
* Strip non-graphable input characters from input. The manualsKristaps Dzonsons2010-07-201-19/+25
| | | | | | | | | specifically say that this is not allowed, and were it allowed, output would be inconsistent across output media (-Tps will puke, non-your-charset terminals will puke, etc.). With this done, simplify check_text() to only check escapes and for tabs. Add in a new tab warning, too.
* Notes: this must be done later. \b in the input will cause havoc.Kristaps Dzonsons2010-06-281-0/+5
|
* Churn as I finish email address migration kth.se -> bsd.lv.Kristaps Dzonsons2010-06-191-1/+1
|
* Squash bug noted by Ulrich Spoerlein where "-" were being converted toKristaps Dzonsons2010-06-091-3/+3
| | | | | | | | | ASCII_HYPH, as per normal, but were screwing up mandoc_special(). Fixed by making mandoc_special() first check isspace() instead of ! isgraph(), then normalise its string as it passes out. This require de-constifying some validation routines not already de-constified (those in libman), but that's ok, because I'd like to be pushing actions into validation routines to save on space and redundant calculations.
* Smarten BADCHAR check to allow ASCII_HYPH.Kristaps Dzonsons2010-05-251-1/+1
| | | | Fix index.sgml not to puke (the relevant section will be re-written for the release anyway, but I hate seeing errors).
* Enable the unified error/warning enumeration in mandoc.h that'sKristaps Dzonsons2010-05-171-29/+38
| | | | | | | | | | | 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-0/+1
|
* Remove `am', `ami', `de', `dei', and `.' from -man, as they're now in the ↵Kristaps Dzonsons2010-05-151-23/+0
| | | | roff preprocessor.
* Pull `ig' out of -man and leave it the roff preparser.Kristaps Dzonsons2010-05-151-3/+1
|
* Removed restriction on integer manual sections in -man.Kristaps Dzonsons2010-05-151-1/+1
|
* Pulled back in mysterious lost le1 <-> eq0 for Sp macro.Kristaps Dzonsons2010-05-141-1/+1
|