| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
any more input files, and it would be misleading to start a parser,
because that would show randomly truncated text.
Instead, print an error message and exit the program.
Issue found by Leah Neukirchen <leah at vuxu dot org>, who was
surprised to see half a manpage when her /tmp/ overflew.
|
|
|
|
|
|
| |
above explaining to human auditors why no error checking is needed
here, so it's only fair to tell the compiler, too.
Worried compiler reported by Michael <Stapelberg at debian>.
|
|
|
|
|
|
|
|
|
|
|
| |
Originally, naddy@ requested this in 2011 (or maybe even earlier).
It was discussed with joerg@, kristaps@, naddy@, and espie@ in 2011,
and everybody agreed in principle, but it was postponed because
kristaps@ wanted to do some cleanup of the message system first.
Meanwhile, message infrastructure was improved about a dozen times...
This makes long, tedious commands like "mandoc -Tlint *.1 2>&1 | less"
unnecessary and allows simple ones like "man -l -Tlint *.1".
|
|
|
|
|
| |
is confusing, simply print "STYLE:", which is intuitive and does not
sound excessively alarming; suggested by jmc@, OK tedu@ jmc@.
|
|
|
|
|
|
| |
once, print "(N times)" after the message "referenced manual not
found", to lessen the risk that people fix the first instance and
miss the others; jmc@ confirmed that this is useful.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
looking in the current working directory. Not a security issue
because the files are never open(2)ed, only access(2)ed.
Requested by jmc@ and inspired by mdoclint(1).
This cannot be perfect because it only works for files having the
exact filename ./pagename.sec - mandoc has no way to figure out
which files might contain a manual for multiple names, or that files
in autohell might be called ./pagename.man.in instead, or which
subdirectories might contain additional source files. Also, it may
hide messages if you have bogus stuff lying around in the directory
where you run mandoc -Tlint. But jmc@ considers it important, and
good enough for everyday use.
Also avoid leaking the memory for the file name while here.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fall back from database search to file system search
just like man(1) does when looking up manuals.
This is not too expensive because on a system having up-to-date
mandoc.db(5) files, it only prolongs the time needed to check
*invalid* references - and you are not supposed to have many of
those, right? And on a system with missing or invalid mandoc.db(5)
files, spending a bit of time and warning loudly about the real
problem is also better than quickly issuing bogus warnings about
cross references that are actually valid.
|
|
|
|
|
|
|
|
|
|
|
|
| |
in the base system, inspired by mdoclint(1).
We are able to do this because (1) the -mdoc parser, the -Tlint validator,
and the man(1) manual page lookup code are all in the same program
and (2) the mandoc.db(5) database format allows fast lookup.
Feedback from, previous versions tested by, and OK jmc@.
A few features will be added to this in the tree, step by step.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-Wopenbsd and -Wnetbsd to check conventions for the base system of
a specific operating system. Mark operating system specific messages
with "(OpenBSD)" at the end.
Please use just "-Tlint" to check base system manuals (defaulting
to -Wall, which is now -Wbase), but prefer "-Tlint -Wstyle" for the
manuals of portable software projects you maintain that are not
part of OpenBSD base, to avoid bogus recommendations about base
system conventions that do not apply.
Issue originally reported by semarie@, solution using
an idea from tedu@, discussed with jmc@ and jca@.
|
| |
|
|
|
|
|
| |
It has been obsolete for more than two years.
Use -T html.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Switch -W all from meaning -W warning to meaning -W style.
The meaning of -T lint does *not* change, it still implies -W warning.
No messages on the new level yet, but they will come.
Usually, i do not lightly make the user interface larger.
But this has been planned for years, and EXIT STATUS 1
was reserved for it all the time. The message system
is now stable enough to finally implement it.
jmc@ regarding the concept: "really good idea"
|
|
|
|
|
|
| |
expression parser, such that "apropos -i 'Nm~dump\>'"
finds kdump(1) and WCOREDUMP(2) and you don't need
to type the counter-intuitive "apropos -- -i 'Nm~dump\>'".
|
|
|
|
|
| |
apropos) option. It will not be implemented. Featurism isn't the
plan for the future; simplicity is.
|
|
|
|
| |
suggested by and OK jmc@
|
|
|
|
|
|
| |
As observed by Jan Stary <hans at stare dot cz>, this is useful such
that after 'alias man="man -m $HOME/man"', 'man -l foo.1' still works.
Simplify and shorten the description of -m, and use .Ic for macros.
|
|
|
|
| |
thanks to reyk@ and to Vsevolod at FreeBSD for suggesting it
|
|
|
|
| |
Patch from semarie@, OK tb@.
|
|
|
|
| |
from Christos Zoulas <christos @ NetBSD>.
|
|
|
|
|
| |
mode and in other output modes, so do not error out prematurely.
Also sort local variables in main() while here.
|
|
|
|
| |
provide a -Onoval output option to show the unvalidated tree.
|
|
|
|
|
| |
and error out if they occur on the command line;
missing feature found in the TODO file
|
|
|
|
|
|
|
| |
such that "cat foo.mdoc | man -l" works.
Issue reported by Christian Neukirchen <chneukirchen at gmail dot com>
and also tested by him on Void Linux with both glibc and musl.
The patch makes sense to millert@.
|
|
|
|
|
|
| |
or during man_validate() have to affect the mandoc(1) EXIT STATUS.
Many thanks to <Yuri dot Pankov at gmail dot com> (illumos developer)
for reporting this regression.
|
|
|
|
|
|
|
|
|
|
|
|
| |
might be in stdio wide orientation due to prior formatting of an
unformatted manual in man -aTutf8 mode. So for now, use fflush(3)
followed by unbuffered write(2) instead. Fixes output corruption
on glibc discovered on Linux while testing a diff to fix a loosely
related bug reported by <jmates at ee dot washington dot edu>.
I detest the concept of stdio stream orientation. One day, i will
rewrite term_ascii.c to always use narrow streams, even in UTF-8
output mode. But that's too much work for today.
|
|
|
|
|
|
| |
fixing a NULL pointer access that happened when the first of multiple pages
shown was preformatted, as in "man -a groff troff".
Crash reported by <jmates at ee dot washington dot edu> on bugs@, thanks!
|
|
|
|
| |
found while investigating an unrelated bug report from jsg@
|
|
|
|
|
| |
Stop supporting systems that don't have mmap(3).
Drop the obsolete names_check() now that we deleted MLINKS.
|
|
|
|
|
|
|
| |
Triggered by a smaller patch from Christos Zoulas.
While here, unify style, move several config tests to config.h,
and delete the useless MANDOC_CONFIG_H.
|
|
|
|
|
|
|
|
|
| |
because we know it is actually mutable or because we are passing
it to a function that doesn't accept a const object but won't
actually attempt to modify it - simply casting from (const type *)
to (type *) is legal C and clearly expresses the intent.
So get rid of the obfuscating UNCONST macro.
Basic idea discussed with guenther@.
|
|
|
|
| |
hid among static functions, as noticed by tedu@ (my bad).
|
|
|
|
| |
noticed by Christos Zoulas with -Wmissing-prototypes
|
|
|
|
|
|
|
| |
is marked as DEPRECATED in OS X after 2011 or so, but has not been
removed and has no replacement.
ok schwarze@
|
|
|
|
|
|
|
| |
compatibility features - so we can safely use more -T on OpenBSD.
But don't do that in the portable version: more -T is unlikely
to work elsewhere.
Issue reported by Svyatoslav Mishyn <juef at openmailbox dot org>.
|
|
|
|
|
|
| |
the same stream, and actually, it fails spectacularly on glibc.
Portability issue pointed out by Svyatoslav Mishyn <juef at openmailbox
dot org> after testing on Void Linux.
|
|
|
|
| |
Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.
|
|
|
|
|
|
|
| |
It could occasionally happen that the child process spawned less(1)
before the parent process passed the control of the terminal to the
child, and in that case, less(1) sometimes complained "Stopped (tty
output)". Issue reported by naddy@.
|
|
|
|
|
|
|
|
|
| |
the same name in sections with an alphabetical suffix (on OpenBSD,
mostly 3p), restoring behaviour of the traditional BSD man(1) that
got lost in the switch to the mandoc-based implementation.
Issue reported by jsg@, using an idea by mikeb@ for the solution,
and at least afresh1@ and jasper@ also seem in favour of the direction.
|
|
|
|
| |
patch from florian@
|
|
|
|
|
|
| |
Just return the file descriptor or -1 on error;
there is just one kind of error anyway.
Suggested by Christos Zoulas (NetBSD).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
closed the file descriptor passed to it after completing its work,
in particular considering the fact that it required its callers
to call open(2) or mparse_open() beforehand.
Change mparse_readfd() to not call close(2) and change the callers
to call close(2) afterwards, more or less bringing open and close
to the same level of the code and making review easier. Note that
man.cgi(8) already did that, even though it was wrong in the past.
Small restructuring suggested by Christos Zoulas (NetBSD).
|
|
|
|
|
|
|
| |
Make sure to always use the idiom 'if (pledge("'
such that it can easily be searched for.
No functional change.
Requested by deraadt@ some time ago.
|
|
|
|
|
| |
found by tb@ and millert@; parts of the code, in particular in tag.c,
by millert@; OK millert@.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
| |
Use the POSIX function getline(3) rather than the slightly
dangerous BSD function fgetln(3).
Remove the related compatibility code.
|
|
|
|
|
| |
In that case, the required prototypes are in "config.h".
Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|