summaryrefslogtreecommitdiffstats
path: root/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix previous: Don't let man(1) warn twice about non-existant names.Ingo Schwarze2015-04-201-5/+9
| | | | Again noticed by deraadt@.
* If apropos(1) finds no match, print "nothing appropriate" to stderrIngo Schwarze2015-04-191-0/+2
| | | | | similar to what the old apropos did. Requested by and OK deraadt@.
* Profit from the unified struct roff_man and reduce the number ofIngo Schwarze2015-04-181-5/+6
| | | | | arguments of mparse_result() by one. No functional change. Written on the ICE Bruxelles-Koeln on the way back from p2k15.
* Replace the structs mdoc and man by a unified struct roff_man.Ingo Schwarze2015-04-181-4/+4
| | | | | Almost completely mechanical, no functional change. Written on the train from Exeter to London returning from p2k15.
* shorten "outdated mandoc.db" warning message; requested by deraadt@Ingo Schwarze2015-04-161-4/+2
|
* No need to hardcode /usr/bin/ as the path to more(1); helps portability.Ingo Schwarze2015-04-031-1/+1
| | | | | We don't hardcode the paths to gunzip(1) and cmp(1) either. Discussed with ajacoutot@.
* First step towards parser unification:Ingo Schwarze2015-04-021-2/+3
| | | | | | Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
* Actually use the new man.conf(5) "output" directive.Ingo Schwarze2015-03-271-8/+9
| | | | Additional functionality, yet minus 45 lines of code.
* Parse the new man.conf(5) "output" directive.Ingo Schwarze2015-03-271-10/+12
| | | | The next step will be to actually use the parsed data.
* Modernize documentation by inserting blanks between option lettersIngo Schwarze2015-03-271-3/+3
| | | | | | and option arguments, except for -m because "-m an" and "-m andoc" look just too weird. Of course, the traditional form without the blank will continue to work.
* Simplify: Now that rc is global anyway, no need to pass it aroundIngo Schwarze2015-03-171-26/+19
| | | | as an argument. No functional change.
* When the user exits the pager before the pager has drained all inputIngo Schwarze2015-03-171-1/+12
| | | | | | | | from man(1), man(1) dies from SIGPIPE. Exiting man(1) is fine in this case, generating more output would be pointless, but without handling SIGPIPE, the exit code from man(1) was wrong and csh(1) printed an ugly message "Broken pipe". Fix this by handling SIGPIPE explicitly. Issue noticed by deraadt@.
* We can keep track of the pager PID without additional complexity.Ingo Schwarze2015-03-101-26/+22
| | | | | No functional change for now, but more robust in case anybody should ever add additional child processes.
* Fix a regression caused in rev. 1.212, reported by kristaps@:Ingo Schwarze2015-03-101-3/+21
| | | | | | | | | | | | When using a pager and the first manual shown is gzip'ed, the gunzip(1) process ended up as a child of the pager process such that the man(1) process couldn't wait for it, preventing proper display of the manual. Solve this by making the pager a child of the man(1) process (instead of the other way round), which requires being a bit more careful about properly closing file descriptors after use and waiting for the pager before exiting man(1).
* Allow compilation on Mac OS X, which doesn't have MACHINE defined.Kristaps Dzonsons2015-03-061-2/+4
| | | | | | While there, specify some casts to satisfy the compiler warnings. OK schwarze@
* When man(1) and apropos(1) look for a file man1/foo.1 but it's unavailable,Ingo Schwarze2015-02-271-8/+19
| | | | | | | fall back to glob(man1/foo.*), which is more like what old man(1) did. Do this both for file names from the database and for fs_lookup(). This is relevant because some ports install files like man1/xset.1x. Regression reported by patrick keshishian <pkeshish at gmail dot com>.
* Delete the -V option. It serves no purpose but keeps confusing people.Ingo Schwarze2015-02-161-16/+4
| | | | | | | | Keeping track of the versions of installed software is the job of the package manager, not of the individual binaries. If individual binaries include version numbers, that tends to goad people into writing broken configuration tests that inspect version numbers instead of properly testing for features.
* trim trailing white space, no code change;Ingo Schwarze2015-02-101-1/+1
| | | | from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux
* be more careful about argc == 0Ingo Schwarze2015-02-071-6/+9
|
* Enable the integrated man(1) even when database support is disabled,Ingo Schwarze2015-02-031-40/+14
| | | | | | using the file system lookup fallback code, also reducing the number of preprocessor conditional directives. Hopefully, it will make some small Linux distros happy.
* Split the -Werror message level into -Werror (broken manual, probablyIngo Schwarze2015-01-201-3/+7
| | | | | | | | | | | | | using mandoc is better than using groff) and -Wunsupp (manual using unsupported low-level roff(7) feature, probably using groff is better than using mandoc). Once this feature is complete, it is intended to help porting, making the decision whether to USE_GROFF easier. As a first step, distinguish four classes of roff(7) requests: 1. Supported (currently 24 requests) 2. Currently ignored because unimportant (120) -> no message 3. Ignored for good because insecure (14) -> -Werror 4. Currently unsupported (68) -> these trigger the new -Wunsupp messages
* Let man(1) show manuals for the current architecture by default,Ingo Schwarze2015-01-161-0/+5
| | | | | and support the MACHINE environment variable as documented in man(1). Missing feature reported by pascal@.
* Fatal errors no longer exist.Ingo Schwarze2015-01-151-7/+2
| | | | | | If a file can be opened, mandoc will produce some output; at worst, the output may be almost empty. Simplifies error handling and frees a message type for future use.
* if earlier files set a non-zero exit status,Ingo Schwarze2015-01-141-6/+12
| | | | do not allow later files to reset it to zero
* Be developer-friendly, 'cause OpenBSD devs like to:Ingo Schwarze2015-01-131-4/+105
| | | | | | | | | | | | | cd /usr/src/share/man/man4; vi newdev.4 Makefile; make install; man newdev When a manual is missing from an outdated database, let man(1) show it anyway, using a KISS file system lookup as a fallback. Requested by deraadt@. 87 new lines of code doesn't seem too much bloat to me. Of course, keeping your mandoc.db(5) files up to date with makewhatis(8) or weekly(8) is still required for apropos(1) to find your new pages.
* do not spawn a pager when there is no output; issue pointed out by deraadt@Ingo Schwarze2015-01-131-24/+35
|
* If man(1) only has one single argument, always interpret it as a name,Ingo Schwarze2015-01-011-1/+2
| | | | | | never as a section. Who would have thought that people call their manual pages 7z(1), 9c(1), 9p(1), and 9p(3)... Patch from Sebastien Marie <semarie dash openbsd at latrappe dot fr>.
* When showing more than one formatted manual page, insert horizontal linesIngo Schwarze2014-12-311-1/+5
| | | | | | between pages. Suggested by Theo Buehler <theo at math dot ethz dot ch>. Even in UTF-8 output mode, do not use fancy line drawing characters such that you can easily use /^--- to skip to the next manual in your pager.
* Use -m for macro set selection in mandoc(1) mode only, not in man(1)Ingo Schwarze2014-12-211-7/+7
| | | | | | and apropos(1) mode. While here, put a space character between options and option arguments in error messages. Both reported by Alessandro DE LAURENZIS <just22 dot adl at gmail dot com>.
* update usage() and the list of non-standard (i.e. non-posix) options;Ingo Schwarze2014-12-181-2/+4
| | | | from jmc@
* Be a bit more lenient in what to accept for section names givenIngo Schwarze2014-12-171-5/+6
| | | | | | as the first man(1) command line argument without -s: Accept digits like "1", "2"; digit+letter like "3p", "1X"; and "n". Issue reported by Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).
* Let "man n open" do the same as "man -s n open" again, that is,Ingo Schwarze2014-12-151-3/+4
| | | | | show the open(n) Tcl manual, as documented in man(1). Issue reported by Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).
* Guard some come needed for database support only by #if HAVE_SQLITE3.Ingo Schwarze2014-12-111-4/+19
| | | | Compiler warnings about unused code reported by wiz@NetBSD.
* Support choosing alternative binary and manual names from configure.local,Ingo Schwarze2014-12-091-5/+4
| | | | to help downstream distributions avoid naming conflicts.
* Integrate the makewhatis binary into the mandoc binaryIngo Schwarze2014-12-091-0/+9
| | | | | just like we do it on OpenBSD. Smaller and neater. While here, let ./configure set INSTALL_TARGETS.
* implement help(1)Ingo Schwarze2014-12-051-8/+21
|
* Switch the default output mode from -Tascii to -Tlocale.Ingo Schwarze2014-12-021-1/+1
| | | | | | | | This doesn't change anything unless LC_CTYPE is set, but it helps when running with LC_TYPE=something.UTF-8. OK tedu@ and earlier positive feedback from: bentley@ deraadt@ naddy@ stsp@ uqs@freebsd wiz@netbsd
* Simplify the mparse_open()/mparse_wait() interface.Ingo Schwarze2014-11-261-7/+3
| | | | | Don't bother the user with the PID of the child process, store it inside the opaque mparse handle.
* In man(1) mode without -a, stop searching after the first manual treeIngo Schwarze2014-11-111-0/+4
| | | | | that contained at least one match in order to not prefer mdoc(1) from ports over mdoc(7). As a bonus, this results in a speedup.
* Let -h imply -c (that is, not use the pager).Ingo Schwarze2014-11-111-0/+1
| | | | | | Usually, -h output is short, so the pager is just a nuisance. Also, traditional man(1) does not use a pager for -h. Triggered by a remark of deraadt@ on ICB.
* implement -h (synopsis only) for preformatted (cat) pages;Ingo Schwarze2014-11-111-14/+54
| | | | requested by tedu@
* add -K to usage() and wrap nicely; from jmc@Ingo Schwarze2014-10-301-2/+2
|
* Make the character table available to libroff so it can check theIngo Schwarze2014-10-281-17/+19
| | | | | | | | validity of character escape names and warn about unknown ones. This requires mchars_spec2cp() to report unknown names again. Fortunately, that doesn't require changing the calling code because according to groff, invalid character escapes should not produce output anyway, and now that we warn about them, that's fine.
* integrate preconv(1) into mandoc(1);Ingo Schwarze2014-10-251-2/+28
| | | | enhances functionality and reduces code and docs by more than 300 lines
* plug file descriptor leaks on read or write failure;Ingo Schwarze2014-10-181-3/+4
| | | | hinted at by Steffen Nurpmeso <sdaoden at yandex dot com>.
* Add *.gz support to apropos(1) -a, man(1), and even mandoc(1).Ingo Schwarze2014-09-031-13/+22
| | | | Implemented by moving the zip code from makewhatis(8) to the parser lib.
* If a manual page is installed gzip(1)ed, let makewhatis(8) takeIngo Schwarze2014-09-031-1/+1
| | | | | | | note in mandoc.db(5), such that man(1) -w and apropos(1) -w can report the correct filename. This is a prerequisite for letting apropos -a and man support gzip'ed manuals in the future, which doesn't work yet.
* Implement the traditional -h option for man(1): show the SYNOPSIS only.Ingo Schwarze2014-09-031-4/+8
| | | | | | | As usual, we get mandoc -h and apropos -h for free. Try stuff like "apropos -h In=dirent" or "apropos -h Fa=timespec". Only useful for terminal output, so -Tps, -Tpdf, -Thtml ignore -h for now.
* In man(1) mode, change to the right directory before starting the parser,Ingo Schwarze2014-09-011-3/+5
| | | | | | | just like traditional man(1) does, such that .so links have a chance to work. After this point, we don't need the current directory for anything else before exit, so we don't need to worry about getting back and we can safely ignore failure.
* Introduce a man(1) -l option as an alias for mandoc -a.Ingo Schwarze2014-08-301-8/+13
| | | | | | | | | | | | | Basically, this does the same as man -l in Linux man-db. The point is that now all functionality of the combined tool is reachable from the man(1) command name: apropos = man -k, whatis = man -f, mandoc = man -cl. Originally suggested by Carsten dot Kunze at arcor dot de, current maintainer of the Heirloom Documentation Tools. While here, add various missing information to the usage() and to the manuals.