summaryrefslogtreecommitdiff
path: root/bk_man.c (follow)
Commit message (Collapse)AuthorAge
* Fix two potential buffer under/overruns.Simon Tatham2017-05-14
| | | | | | | | | | | | | The one in wcwidth.c actually came up in one of my valgrind runs: if you passed it a non-null-terminated wide string (specifically, one that reaches invalid memory exactly when the length parameter runs out), it would illegally load the character beyond the end of the string before noticing that the length parameter said it shouldn't. The one in bk_man.c may well not be able to come up at all, but I spotted it in passing and I thought I might as well fix it - it makes me twitch on general principles to see any use of buf[len-1] without having checked len>0 first.
* Add \s for 'strong' text, i.e. bold rather than italics. I've missedSimon Tatham2013-03-10
| | | | | | | | | | | | | | this a couple of times in Halibut markup recently (in particular, it's handy to have a typographical distinction between 'this term is emphasised because it's new' and 'this term is emphasised because I want you to pay attention to it'), so here's an implementation, basically parallel to \e. One slight oddity is that strong text in headings will not be distinguished in some output formats, since they already use bolded text for their headings. [originally from svn r9772]
* Revamp of the Halibut error handling mechanism.Simon Tatham2012-08-29
| | | | | | | | | | | | | | | | I'm not quite sure why I ever thought it was a good idea to have a central variadic error() function taking an integer error code followed by some list of arguments that depend on that code. It now seems obvious to me that it's a much more sensible idea to have a separate function per error, so that we can check at compile time that the arguments to each error call are of the right number and type! So I've done that instead. A side effect is that the errors are no longer formatted into a fixed-size buffer before going to stderr, so I can remove all the %.200s precautions in the format strings. [originally from svn r9639]
* Allow a hastily selected subset of the output formats to also acceptSimon Tatham2009-10-24
| | | | | | | | | | | | | | | | | | | | "-" as a special file name meaning standard output. I've restricted it to just those output formats which can predictably output only one file, just for the sake of not having to faff too much with the others. Probably what I should have done for all of this would have been to write a set of wrappers around fopen, fclose and everything in between, and use them everywhere. Those wrappers would uniformly detect "-" and convert it into stdin or stdout as appropriate, would avoid fclosing those files for real when told to close them, and would also be able to handle reading a little bit of data from the start of a file and then pushing it all back even if the file were not seekable (which would allow input.c to lose the ugly special case whereby it can't currently read font files from standard input). [originally from svn r8729]
* Revise r8309 to use \- rather than - when trying to emit a literal U+002D;Jacob Nevins2009-09-06
| | | | | | | | apparently this is preferred (it's what pod2man uses); cf Debian #496063, #159872. [originally from svn r8641] [r8309 == 73e8c7d1b4ac77ec1b5acc700cb3af277a150bcf]
* More portable attempt to get a literal U+0027 than r8321, pinched from pod2manJacob Nevins2009-09-06
| | | | | | | (via Colin in Debian bug#496063). [originally from svn r8640] [r8321 == 5e7a3a5b1bbaccb7ce7d61bb9bc4654924135dfb]
* Extend r8309 to try to ensure that single-quote/apostrophe characters in codeJacob Nevins2008-11-23
| | | | | | | | | | contexts get output usefully in the face of UTF-8 *roff implementations. Works on Debian-derived distributions (and hence along with r8309 should fix #496063), but I'm slightly worried about portability as I've used a named character "\(aq" which doesn't appear in the "classic" reference CS TR #54. [originally from svn r8321] [r8309 == 73e8c7d1b4ac77ec1b5acc700cb3af277a150bcf]
* Don't translate hyphens into \(hy inside \c{...} or code paragraphs,Simon Tatham2008-11-21
| | | | | | | | | | because otherwise UTF-8 versions of man(1) tend to turn them into Unicode hyphen characters, with the result that if you cut and paste sample command lines out of man pages in the obvious way then the things that look like hyphens are not in fact the character that the program in question would recognise as an option introducer. [originally from svn r8309]
* `man', at least on Debian 3.1, will treat a paragraph beginning withSimon Tatham2006-10-11
| | | | | | | | | | | | a period specially _even_ if there's an \fB or similar escape sequence before the period. Therefore, man_rdaddctrl() now doesn't clear the QUOTE_INITCTRL flag just because it generated some text; instead, its call sites clear the flag when the _type_ of generated text is appropriate for this. This should remove an error from the `lns' man page (utils/lns/lns.but), which was where I noticed the problem. [originally from svn r6871]
* Factor out another routine from man_rdaddwc(), this one to add a controlBen Harris2006-05-07
| | | | | | | string to the output. This incidentally fixes a bug whereby font changes at the start of a line weren't resetting QUOTE_INITCTRL. [originally from svn r6660]
* Pull the code to reset the output charset state out of man_rdaddwc() intoBen Harris2006-05-07
| | | | | | | its own function, since it's called so many times. Also call it in two places I'd missed. [originally from svn r6659]
* When we want a printed backslash, use \e rather than \\, since the formerBen Harris2006-05-07
| | | | | | works correctly inside macro arguments. [originally from svn r6658]
* Add support for nonbreaking hyphens to the "man" backend. man_rdaddwc() is ↵Ben Harris2006-05-06
| | | | | | | | beginning to get ugly. [originally from svn r6654]
* Support for non-breaking spaces in the "man" backend. This has the odd ↵Ben Harris2006-05-06
| | | | | | | | | side-effect that breaking spaces are now forces to be ASCII spaces in output, whatever output charset is in force. I doubt this will inconvenience anyone. [originally from svn r6652]
* Improve rule generation in the "man" backend so that if the outputBen Harris2006-05-06
| | | | | | | is processed by nroff, the rule is made up of \cfg{man-rule} characters (same defaults as \cfg{text-rule}). [originally from svn r6651]
* Support for TROFF named characters, so we can have proper bullets in our lists,Ben Harris2006-05-06
| | | | | | | and incidentally proper (single) quotation marks too. This reworks a lot of man_convert, but I think the result is correct. [originally from svn r6650]
* better para_Rule implementation for "man" backend, using TROFF's built-inBen Harris2006-05-06
| | | | | | line-drawing function. [originally from svn r6648]
* Ben Hutchings points out that `.UC', which I think I must haveSimon Tatham2005-07-29
| | | | | | | | | copied mindlessly from whatever man page I read when working out the format of man pages, has the function of putting `3rd Berkely Distribution' in one of the footer slots and therefore is probably inaccurate... [originally from svn r6146]
* The heading depth of a para_Subsect is p->aux+1, not p->aux+2.Ben Harris2005-05-18
| | | | | | Spotted (indirectly) by Damien Miller. [originally from svn r5802]
* It turns out that the man format requires the \& sequence (toSimon Tatham2004-11-21
| | | | | | | neutralise a dot at the start of a line) even if there's been an \fB-type sequence on the line before the dot. [originally from svn r4867]
* man supports `.SS' for subsection headings. Use it.Simon Tatham2004-11-06
| | | | [originally from svn r4758]
* Explicitly bless in the documentation, and fix in the man backend,Simon Tatham2004-08-06
| | | | | | | the practice of using \dt and \dd in anything other than the obvious interleaving. [originally from svn r4417]
* Sort out error handling everywhere a charset name is converted intoSimon Tatham2004-06-27
| | | | | | an integer charset ID. [originally from svn r4317]
* s/text-quotes/man-quotes/. Damn cut and paste. Thanks Jacob.Simon Tatham2004-06-16
| | | | [originally from svn r4288]
* Switch the memory allocation macros from the Halibut onesSimon Tatham2004-06-12
| | | | | | | | | | | | | (mknew/mknewa/resize) to the PuTTY ones (snew/snewn/sresize). snewn and mknewa have their arguments opposite ways round; this may make the change initially painful but in the long term will free me of a nasty context switch every time I move between codebases. Also sresize takes an explicit type operand which is used to cast the return value from realloc, thus enforcing that it must be correct, and arranging that if anyone tries to compile Halibut with a C++ compiler there should be a lot less pain. [originally from svn r4276]
* Configurable bullet and quote characters for the man backend.Simon Tatham2004-05-23
| | | | [originally from svn r4247]
* Charset support for the man page backend (\cfg{man-charset}).Simon Tatham2004-04-21
| | | | [originally from svn r4112]
* Infrastructure changes for character set support. ustrtoa,Simon Tatham2004-04-20
| | | | | | | | | | | ustrfroma, utoa_dup and ufroma_dup now take a charset parameter, and also have a variety of subtly distinct forms. Also, when a \cfg directive is seen in the input file, the precise octet strings for each parameter are kept in their original form as well as being translated into Unicode, so that when they represent filenames they can be used verbatim. [originally from svn r4097]
* Better robustness when backends encounter a Unicode character notSimon Tatham2004-04-19
| | | | | | representable in the output character set. [originally from svn r4094]
* Initial work on PS and PDF output. Because these two backends shareSimon Tatham2004-04-13
| | | | | | | | | | | | | | | | | | | an enormous amount of preprocessing and differ only in their final output form, I've introduced a new type of layer called a `pre-backend' (bk_paper.c is one). This takes all the information passed to a normal backend and returns an arbitrary void *, which is cached by the front end and passed on to any backend(s) which state a desire for the output of that particular pre-backend. Thus, all the page layout is done only once, and the PS and PDF backends process the same data structures into two output files. Note that these backends are _very_ unfinished; all sorts of vital things such as section numbers, list markers, and title formatting are missing, the paragraph justification doesn't quite work, and advanced stuff like indexes and PDF interactive features haven't even been started. But this basic framework generates valid output files and is a good starting point, so I'm checking it in. [originally from svn r4058]
* Arrange a mechanism whereby each backend can be passed a filenameSimon Tatham2004-04-01
| | | | | | | | | from its command-line option (`--text=foo.txt') and automatically convert it into one or more notional \cfg directives. In the HTML case this mechanism enables single-file mode as well as setting the filename. [originally from svn r4018]
* Add \cfg / -C directives to allow the user to choose the output fileSimon Tatham2004-04-01
| | | | | | name (or name schema, in HTML). [originally from svn r4017]
* Simplify treatment of the copyright notice, now I've also simplifiedSimon Tatham2004-03-30
| | | | | | | | | the preamble: \copyright paragraphs are now treated identically to normal paragraphs (so they appear precisely where they're put instead of in a fixed location), _except_ that the Windows Help backend also copies their text into the help file's copyright slot. [originally from svn r4001]
* Obsoleted the `\preamble' command. Preamble text is now taken to beSimon Tatham2004-03-25
| | | | | | | | | | any ordinary displayable paragraph(s) appearing before the first chapter heading, meaning in particular that you can put lists, code paragraphs etc in preambles. Of course, `\preamble' is still supported for backwards compatibility, but it's now a zero-effect paragraph marker. [originally from svn r3981]
* Add a \quote{...} directive, working like <blockquote> in HTML.Simon Tatham2004-03-25
| | | | [originally from svn r3978]
* Apparently we must include the .TH directive in a man page even whenSimon Tatham2004-03-25
| | | | | | there's nothing to go in it. [originally from svn r3977]
* Cleanups to complete the man page backend. Also, an additional newSimon Tatham2004-03-24
| | | | | | | | | | | | | markup feature: a \c line in a code paragraph can now be followed by an optional \e line indicating emphasised bits of its preceding \c. This allows discretionary bolding and (italic/underline) emphasis within code paragraphs, but without introducing an escape character or breaking any existing input files. Users are warned that not all backends are required to actually render these hints, and so they should avoid depending on them 100% to convey semantic information unless they know they're writing for a restricted range of backends. [originally from svn r3965]
* Man-page back end for Halibut. Also, a couple of additional markupSimon Tatham2004-03-23
features commonly used in man pages: (a) the ability to nest paragraph breaks, code paragraphs and other lists inside list items, and (b) description lists as normally used in man pages to describe command-line options. [originally from svn r3954]