summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
AgeCommit message (Collapse)Author
2015-11-26No point in trying to go on when elementary database operationsIngo Schwarze
like preparing queries or binding variables fail; that won't yield useful results anyway but may generate huge pointless error messages. Issue reported by deraadt@.
2015-11-20Fix multiple issues regarding process group and signal mask handlingIngo Schwarze
found by tb@ and millert@; parts of the code, in particular in tag.c, by millert@; OK millert@.
2015-11-14Fix an issue reported by deraadt@: When hitting Ctrl-Backslash (= SIGQUIT)Ingo Schwarze
in the less(1) spawned by man(1), man(1) died uncleanly, leaving behind its temp files, and killed less(1) uncleanly as well with SIGPIPE, leaving the terminal in the wrong state. Fix this by giving less(1) its own process group and handing it control of the terminal, but in such a way that Ctrl-z (= SIGSTOP) still works: In that case, let man(1) stop itself, too, and let it continue the pager when it continues itself. Joint work with millert@ who contributed most of the expertise required, and also most parts of the code. OK deraadt@ millert@
2015-11-12Simplify the logic in mandoc_normdate() and add some comments.Ingo Schwarze
Also add a comment in time2a() explaining why it isn't possible to use just one single call to strftime(). Do some style cleanup while here. No functional change. Triggered by a very different patch from des@FreeBSD.
2015-11-12Never use LC_ALL. On the one hand, it can cause misformatting.Ingo Schwarze
On the other hand, it is a security risk because it might cause buffer overflows. Use LC_CTYPE only, that's all we need.
2015-11-07Modernization, no functional change intended:Ingo Schwarze
Use the POSIX function getline(3) rather than the slightly dangerous BSD function fgetln(3).
2015-11-07In private header files, __BEGIN_DECLS and __END_DECLS are pointless.Ingo Schwarze
Because these work slightly differently on different systems, they are becoming a maintenance burden in the portable version, so delete them. Besides, one of the chief design goals of the mandoc toolbox is to make sure that nothing related to documentation requires C++. Consequently, linking mandoc against any kind of C++ program would defeat the purpose and is not supported. I don't understand why kristaps@ added them in the first place.
2015-11-06correct exit status on pledge(2) errorsIngo Schwarze
2015-11-06Use getprogname(3) rather than __progname.Ingo Schwarze
Suggested by Joerg@ Sonnenberger (NetBSD). Last year, deraadt@ confirmed on tech@ that this "has the potential to be more portable", and micro-optimizing for speed is not relevant here. Also gets rid of one global variable.
2015-11-05Use include files "header.html" and "footer.html" rather than aIngo Schwarze
compiled-in string. This is not a security risk, we read the file manpath.conf from the same directory, anyway. No error handling is needed; even if the files are absent, that's not an error. This is more flexible without causing complication of the code or the user interface. It helps the upcoming revamp of the online manual pages on man.NetBSD.org. Based on an idea by Jean-Yves Migeon <jeanyves dot migeon at free dot fr>, but implemented in a much simpler way.
2015-11-05simplify: use one stylesheet rather than two; from bentley@Ingo Schwarze
2015-10-30If a .Bd block has no arguments at all, drop the block and only keepIngo Schwarze
its contents. Removing a gratuitious difference to groff output found after a related bug report from krw@.
2015-10-30Do not access a NULL pointer when a .Bd macro has no arguments at all.Ingo Schwarze
Bug reported by krw@.
2015-10-23apply bold and italic to all non-ASCII Unicode codepoints,Ingo Schwarze
fixing input like \fB\('e; issue reported by bentley@
2015-10-22use the new function man_validate() here, tooIngo Schwarze
2015-10-22move man(7) validation into the dedicated validation phase, tooIngo Schwarze
2015-10-22If no output device was allocated because no file wanted to produce output,Ingo Schwarze
refrain from dereferencing a NULL pointer during final deallocation. Fixing a recent regression reported by czarkoff@
2015-10-21Move all mdoc(7) node validation done before child parsingIngo Schwarze
to the new separate validation pass, except for a tiny bit needed by the parser which goes to the new mdoc_state() module; cleaner, simpler, and surprisingly also shorter by 15 lines.
2015-10-20In order to become able to generate syntax tree nodes on the roff(7)Ingo Schwarze
level, validation must be separated from parsing and rewinding. This first big step moves calling of the mdoc(7) post_*() functions out of the parser loop into their own mdoc_validate() pass, while using a new mdoc_state() module to make syntax tree state handling available to both the parser loop and the validation pass.
2015-10-19style cleanup, no functional changeIngo Schwarze
2015-10-19Simplify, no functional change:Ingo Schwarze
Delete the outmdoc, outman, and outfree function pointers.
2015-10-19including <ohash.h> requires including <stdint.h> beforehand;Ingo Schwarze
noticed by Svyatoslav Mishyn <juef at openmailbox dot org>
2015-10-17Very tricky diff to fix macro interpretation and spacing around tabsIngo Schwarze
in .Bl -column; it took me more than a day to get this right. Triggered by a loosely related bug report from tim@. The lesson for you is: Use .Ta macros in .Bl -column, avoid tabs, or you are in for surprises: The last word before a tab is not interpreted as a macro (unless there is a blank in between), the first word after a tab isn't either (unless there is a blank in between), and a blank after a tab causes a leading blank in the respective output cell. Yes, "blank", "tab", "blank tab" and "tab blank" all have different semantics; if you write code relying on that, good luck maintaining it afterwards...
2015-10-16Once apropos(1) or man(1) are done with database access, or if theIngo Schwarze
program was called as mandoc(1) in the first place, remove "flock" from our pledge(2) before entering the parsers and formatters. OK millert@ deraadt@
2015-10-16Implement real "flock" request and add it to userland programs thatTodd C. Miller
use pledge and file locking. OK deraadt@
2015-10-15Delete two preprocessor constants that are no longer used.Ingo Schwarze
Patch from Michael Reed <m dot reed at mykolab dot com>.
2015-10-15Simplify the part of args() that is handling .Bl -column phrases:Ingo Schwarze
Delete manual "Ta" handling because macro handling should not be done in an argument parser but should be left to the macro parsers, which exist anyway and work well. No functional change, minus 40 lines of code. Confusing and redundant code found while investigating an old bug report from tim@.
2015-10-15When blk_full() handles an .It line in .Bl -column and indirectlyIngo Schwarze
calls phrase_ta() to handle a .Ta child macro, advance the body pointer accordingly, such that a subsequent tab character rewinds the right body block and doesn't fail an assertion. That happened when there was nothing between the .Ta and the tab character. Bug reported by tim@ some time ago.
2015-10-13Reject the escape sequences \[uD800] to \[uDFFF] in the parser.Ingo Schwarze
These surrogates are not valid Unicode codepoints, so treat them just like any other undefined character escapes: Warn about them and do not produce output. Issue noticed while talking to stsp@, semarie@, and bentley@.
2015-10-13Major character table cleanup:Ingo Schwarze
* Use ohash(3) rather than a hand-rolled hash table. * Make the character table static in the chars.c module: There is no need to pass a pointer around, we most certainly never want to use two different character tables concurrently. * No need to keep the characters in a separate file chars.in; that merely encourages downstream porters to mess with them. * Sort the characters to agree with the mandoc_chars(7) manual page. * Specify Unicode codepoints in hex, not decimal (that's the detail that originally triggered this patch). No functional change, minus 100 LOC, and i don't see a performance change.
2015-10-13Reduce the amount of code by moving the three copies of the ohashIngo Schwarze
callback functions into one common place, preparing for the use of ohash for some additional purposes. No functional change.
2015-10-12plegde(2) for apropos(1), help(1), man(1), mandoc(1), and whatis(1):Ingo Schwarze
Always needed: stdio rpath (to open multiple files and for .so) In addition after starting the pager: tmppath (to clean up the temp files) In addition before starting the pager: proc exec Looks good to deraadt@.
2015-10-12pledge(2) for makewhatis(8):Ingo Schwarze
Always needed: stdio rpath. In addition when writing to an existing db: wpath cpath fattr. In addition when creating a new db: proc exec. Based on work by and OK bentley@, "get moving" deraadt@.
2015-10-12Delete an assignment that is unconditionally overwritten two lines later;Ingo Schwarze
found by Svyatoslav Mishyn <juef at openmailbox dot org> with the clang static analyzer.
2015-10-12Garbage collect an unused variable, no functional change;Ingo Schwarze
found by Svyatoslav Mishyn <juef at openmailbox dot org> with cppcheck.
2015-10-12Check the right pointer against NULL;Ingo Schwarze
fixing a pasto introduced in the previous commit; found by Svyatoslav Mishyn <juef at openmailbox dot org> with cppcheck.
2015-10-12Use "-" rather than "\(hy" for the heads of .Bl -dash and -hyphen lists.Ingo Schwarze
In UTF-8 output, that renders as ASCII HYPHEN-MINUS (U+002D) rather than HYPHEN (U+2010), which looks better and matches groff. In ASCII output, it makes no difference. Suggested by naddy@.
2015-10-12Clear dform and dsec when exiting a first-level directory in treescan().Ingo Schwarze
Fixes a segfault reported by bentley@. While here, do some style cleanup in the same function.
2015-10-12Fix an obvious bug found during the /* FALLTHROUGH */ cleanup:Ingo Schwarze
ASCII_NBRSP has to be rendered as "&nbsp;", not "-".
2015-10-12To make the code more readable, delete 283 /* FALLTHROUGH */ commentsIngo Schwarze
that were right between two adjacent case statement. Keep only those 24 where the first case actually executes some code before falling through to the next case.
2015-10-11Drop tags containing a blank character:Ingo Schwarze
They don't work, they break other tags in weird ways, and even if they could be made to work, they would be mostly useless. Issue reported by naddy@, thanks.
2015-10-11Finally use __progname, err(3) and warn(3).Ingo Schwarze
That's more readable and less error-prone than fumbling around with argv[0], fprintf(3), strerror(3), perror(3), and exit(3). It also shortens the code by 50 lines. It's a bad idea to boycott good interfaces merely because standards committees ignore them. Instead, it's the job of the portable distribution to provide compatibility modules for archaic systems (like commercial Solaris) that still don't have them. Actually, the compat code for the portable distribution already exists and will be committed right after this.
2015-10-10Decide whether to use_pager as early as possible,Ingo Schwarze
in preparation for pledge(2); no functional change intended.
2015-10-06modernize style: "return" is not a function; ok cmp(1)Ingo Schwarze
2015-09-26tweak previous;Jason McIntyre
2015-09-26briefly document -T tree outputIngo Schwarze
2015-09-26Show the flags MDOC_DELIMO, MDOC_DELIMC, MDOC_EOS, and MAN_EOS.Ingo Schwarze
Drop the "block-" prefixes from the node type names.
2015-09-26/* NOTREACHED */ after abort() is silly, delete itIngo Schwarze
2015-09-26resolve code duplication and do style cleanup in mdoc_nm_pre(),Ingo Schwarze
no functional change
2015-09-26Fix multiple aspects of SYNOPSIS .Nm formatting:Ingo Schwarze
* Don't break lines before non-block .Nm elements. * Use proper <b> markup for the heads of .Nm blocks. * Make the width measurements work by doing them on the head children.