]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
8 years agoWhen the database is corrupt in the sense of containing invalid
Ingo Schwarze [Tue, 30 Aug 2016 22:01:07 +0000 (22:01 +0000)]
When the database is corrupt in the sense of containing invalid
pointers in the pages table, do not access NULL pointers, but
gracefully handle the errors.
Similar patches will be needed for the macro tables, too.
<attila at stalphonsos dot com> audited the code and pointed out to me
that dbm_get() can return NULL for corrupted databases, but that isn't
handled properly at various places.

8 years agoless confusing warning message about negative offsets
Ingo Schwarze [Tue, 30 Aug 2016 21:37:24 +0000 (21:37 +0000)]
less confusing warning message about negative offsets

8 years agoIf a line inside .Bl -column starts with a tab character
Ingo Schwarze [Sun, 28 Aug 2016 16:15:12 +0000 (16:15 +0000)]
If a line inside .Bl -column starts with a tab character
and there was no preceding .It macro, do not read the byte
before the beginning of the line buffer.
Found by tb@ with afl@.

8 years agoWhen trying to edit an existing database with makewhatis(8) -d or -u
Ingo Schwarze [Mon, 22 Aug 2016 16:15:26 +0000 (16:15 +0000)]
When trying to edit an existing database with makewhatis(8) -d or -u
but reading the database fails, report the full path to the database
on standard error, and mention that the database is automatically
recreated from scratch.
Suggested by espie@.

8 years agoWhen running into a mandoc.db(5) file still using the obsolete
Ingo Schwarze [Mon, 22 Aug 2016 16:07:16 +0000 (16:07 +0000)]
When running into a mandoc.db(5) file still using the obsolete
format based on SQLite 3, say so in words that mortals can
understand rather than babbling about hex magic.
Suggested by espie@.

8 years agoWhen a mismatching end macro occurs while at least two nested blocks
Ingo Schwarze [Sat, 20 Aug 2016 17:59:34 +0000 (17:59 +0000)]
When a mismatching end macro occurs while at least two nested blocks
are open, all except the innermost open block got a bogus MDOC_ENDED
marker, in some situations triggering segfaults down the road
which tb@ found with afl(1).
Fix the logic error by figuring out up front whether an end macro
has a matching body, and if it hasn't, don't mark any blocks as broken.

8 years agoWhen scanning upwards for a column list to put a .Ta macro in,
Ingo Schwarze [Sat, 20 Aug 2016 15:58:21 +0000 (15:58 +0000)]
When scanning upwards for a column list to put a .Ta macro in,
ignore body end markers of lists breaking other blocks.
Fixing a logical error that caused a NULL deref found by tb@ with afl(1).

8 years agoIf a column list starts with implicit rows (that is, rows without .It)
Ingo Schwarze [Sat, 20 Aug 2016 14:43:50 +0000 (14:43 +0000)]
If a column list starts with implicit rows (that is, rows without .It)
and roff-level nodes (e.g. tbl or eqn) follow, don't run into an
assertion.  Instead, wrap the roff-level nodes in their own row.
Issue found by tb@ with afl(1).

8 years agofix an fd leak; patch from jsg@
Ingo Schwarze [Thu, 18 Aug 2016 09:02:34 +0000 (09:02 +0000)]
fix an fd leak; patch from jsg@

8 years agoWhen the content of a manual page does not specify a section, the
Ingo Schwarze [Wed, 17 Aug 2016 20:46:56 +0000 (20:46 +0000)]
When the content of a manual page does not specify a section, the
empty string got added to the list of sections, breaking the database
format slightly and causing the page to not be considered part of
any section, not even if a section could be deduced from the directory
or from the file name.
Bug found due to the bogus pcredemo(3) "manual" in the pcre-8.38p0 package.

8 years agoWhen reading back a mandoc.db(5) file in order to apply incremental
Ingo Schwarze [Wed, 17 Aug 2016 18:59:37 +0000 (18:59 +0000)]
When reading back a mandoc.db(5) file in order to apply incremental
changes, do not prepend a stray NAME_FILE (0x10) byte to the first
names of pages.
Bug found while investigating another issue reported by sthen@.

8 years agoMake sure manuals in architecture-independent directories are treated
Ingo Schwarze [Wed, 17 Aug 2016 18:10:39 +0000 (18:10 +0000)]
Make sure manuals in architecture-independent directories are treated
as architecture-independent even if they abuse the third (architecture)
argument of the .Dt macro for random stuff like "freetds reference manual".
While the .Dt syntax is not the same as the .TH syntax in man(7),
punishing offenders by treating them as architecture-dependent and
hence completely excluding them from searches is too severe.
Problem reported by sthen@.

8 years agoEven after switching from a pending head to the body, we have to
Ingo Schwarze [Thu, 11 Aug 2016 13:30:25 +0000 (13:30 +0000)]
Even after switching from a pending head to the body, we have to
continue scanning upwards, because the enclosing block might already
be pending as well, e.g. .Bl .Bl .It Bo .El .It.
Tree corruption leading to a later NULL deref found by tb@ with afl(1).

8 years agooops, fix stupid typo in previous
Ingo Schwarze [Thu, 11 Aug 2016 11:39:46 +0000 (11:39 +0000)]
oops, fix stupid typo in previous

8 years agoIf a .Bd display is on the one hand doomed to be deleted because
Ingo Schwarze [Thu, 11 Aug 2016 10:47:16 +0000 (10:47 +0000)]
If a .Bd display is on the one hand doomed to be deleted because
it has no type, but is on the other hand breaking another block,
delete its end marker as well, or the end marker may remain behind
as an orphan, triggering an assertion in the terminal formatter.
Problem found by tb@ with afl(1).

8 years agoDon't deref NULL if the only child of the first .Sh is an empty
Ingo Schwarze [Wed, 10 Aug 2016 20:17:50 +0000 (20:17 +0000)]
Don't deref NULL if the only child of the first .Sh is an empty
in-line macro, and don't printf("%s", NULL) if the first child
of the first .Sh is a macro; again found by tb@ with afl(1).
(No, you should never use macros in any .Sh at all, please.)

8 years agomove armish and hppa64 down in the dropdown box; reminded by jmc@
Ingo Schwarze [Wed, 10 Aug 2016 18:39:23 +0000 (18:39 +0000)]
move armish and hppa64 down in the dropdown box; reminded by jmc@

8 years agoWhen trying to figure out which C compiler make(1) wants to use,
Ingo Schwarze [Wed, 10 Aug 2016 12:50:24 +0000 (12:50 +0000)]
When trying to figure out which C compiler make(1) wants to use,
pass it the POSIX -s option.  On most systems, this won't make a
difference, but Bdale Garbee reported that the make(1) on his Debian
system, most likely some version of gmake, breaks Makefile.local
by printing some 'entering directory' messages.  I failed to reproduce
and Bdale didn't report back, but judging from gmake source code,
this is likely to help and unlikely to do harm elsewhere.

8 years agoDon't printf("%s", NULL) if .It has a macro as an argument
Ingo Schwarze [Wed, 10 Aug 2016 12:29:38 +0000 (12:29 +0000)]
Don't printf("%s", NULL) if .It has a macro as an argument
in a list of a type where items don't takes arguments.
Issue found by tb@ with afl(1).

8 years agoWhen validating a .Bl list that defaults to -item for want of a type,
Ingo Schwarze [Wed, 10 Aug 2016 12:06:41 +0000 (12:06 +0000)]
When validating a .Bl list that defaults to -item for want of a type,
don't let a subsequent -width access mdoc_argnames[] out of bounds.
Found by tb@ with afl(1).

8 years agoFix assertion failures caused by whitespace inside \o'' (overstrike)
Ingo Schwarze [Wed, 10 Aug 2016 11:03:43 +0000 (11:03 +0000)]
Fix assertion failures caused by whitespace inside \o'' (overstrike)
sequences that jsg@ found with afl(1):
* Avoid writing \t\b in term.c.
* Handle trailing \b in term_ps.c.

8 years agofix printf("%s", NULL);
Ingo Schwarze [Tue, 9 Aug 2016 15:09:27 +0000 (15:09 +0000)]
fix printf("%s", NULL);
found while investigating an unrelated bug report from jsg@

8 years agoThe concept of endianness seems to be somewhat newfangled, so the
Ingo Schwarze [Fri, 5 Aug 2016 23:15:08 +0000 (23:15 +0000)]
The concept of endianness seems to be somewhat newfangled, so the
respective conversion functions are not yet properly standardized.
Rumour has it that POSIX is working on it, though.
For now, sprinkle some configuration glue.

8 years agoReally protect <err.h> as already promised in the previous commit message.
Ingo Schwarze [Fri, 5 Aug 2016 23:08:03 +0000 (23:08 +0000)]
Really protect <err.h> as already promised in the previous commit message.

8 years agomissing <endian.h> reported by Bapt@iste Daroussin, found on FreeBSD
Ingo Schwarze [Fri, 5 Aug 2016 21:38:11 +0000 (21:38 +0000)]
missing <endian.h> reported by Bapt@iste Daroussin, found on FreeBSD

8 years agofix a typo that prevented names from .Dt from getting priority
Ingo Schwarze [Fri, 5 Aug 2016 17:22:45 +0000 (17:22 +0000)]
fix a typo that prevented names from .Dt from getting priority
over names from .Sh NAME

8 years agoFix an assertion failure that happened when trying to add a page
Ingo Schwarze [Thu, 4 Aug 2016 09:33:57 +0000 (09:33 +0000)]
Fix an assertion failure that happened when trying to add a page
with makewhatis -d to a completely empty database.
Reported by Mark Patruck <mark at wrapped dot cx>, thanks!

8 years agoPOSIX allows PATH_MAX to not be defined, meaning "unlimited".
Ingo Schwarze [Tue, 2 Aug 2016 11:09:46 +0000 (11:09 +0000)]
POSIX allows PATH_MAX to not be defined, meaning "unlimited".
Found by Aaron M. Ucko <amu at alum dot mit dot edu> on the GNU Hurd,
via Bdale Garbee, https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829624

Also add EFTYPE at two places where it was forgotten.

8 years agoRepair makewhatis -t, regression in rev. 1.221 reported by naddy@.
Ingo Schwarze [Mon, 1 Aug 2016 20:53:13 +0000 (20:53 +0000)]
Repair makewhatis -t, regression in rev. 1.221 reported by naddy@.

8 years agoAdjust MANDOC_DB and bump MANDOCDB_VERSION now that
Ingo Schwarze [Mon, 1 Aug 2016 12:31:00 +0000 (12:31 +0000)]
Adjust MANDOC_DB and bump MANDOCDB_VERSION now that
this was put into production in OpenBSD-current.

8 years agodocument the new file format
Ingo Schwarze [Mon, 1 Aug 2016 12:27:15 +0000 (12:27 +0000)]
document the new file format

8 years agoSome base system pages, for example perl(1), contain non-ASCII
Ingo Schwarze [Sun, 31 Jul 2016 23:37:23 +0000 (23:37 +0000)]
Some base system pages, for example perl(1), contain non-ASCII
characters in their source code, so switch on charset autodetection
in the same way as in man(1) itself.
Issue reported by Pavan Maddamsetti at gmail dot com on bugs@.

8 years agoAutodetect a suitable locale for -Tutf8 mode,
Ingo Schwarze [Sun, 31 Jul 2016 09:29:13 +0000 (09:29 +0000)]
Autodetect a suitable locale for -Tutf8 mode,
and allow overriding it manually.
Based on a patch from Svyatoslav Mishyn <juef at openmailbox dot org>
tweaked by me.
The idea originally came up in a conversation with Markus Waldeck.

8 years agoSort sections and architectures in the pages table.
Ingo Schwarze [Fri, 29 Jul 2016 15:29:32 +0000 (15:29 +0000)]
Sort sections and architectures in the pages table.

8 years agoSort pages in the pages table by file names.
Ingo Schwarze [Fri, 29 Jul 2016 15:26:37 +0000 (15:26 +0000)]
Sort pages in the pages table by file names.

8 years agoNo need to populate the TYPE_arch and TYPE_sec bits, the information
Ingo Schwarze [Fri, 29 Jul 2016 15:23:57 +0000 (15:23 +0000)]
No need to populate the TYPE_arch and TYPE_sec bits, the information
is provided directly to dba_page_add() in dbadd_mlink()
and to dba_page_new() in dbadd().

No need for a dedicated loop for NAME_FILE.
It's done in dbadd_mlink() anyway.

In this context, also record section numbers taken from filenames
and from .Dt and .TH macros, architectures taken from .Dt macros,
and fix the filtering of duplicate filename entries.

8 years agoAutodetect if -lrt is needed for nanosleep(3).
Ingo Schwarze [Wed, 20 Jul 2016 14:03:06 +0000 (14:03 +0000)]
Autodetect if -lrt is needed for nanosleep(3).
Helpful for Solaris 9 and 10.
Reminded by Thomas Klausner.

8 years agotag_signal() is dead; from LLVM via Christos Zoulas
Ingo Schwarze [Wed, 20 Jul 2016 13:03:24 +0000 (13:03 +0000)]
tag_signal() is dead; from LLVM via Christos Zoulas

8 years agoLinux compatibility: Work around the lack of EFTYPE and protect <err.h>.
Ingo Schwarze [Wed, 20 Jul 2016 00:23:14 +0000 (00:23 +0000)]
Linux compatibility: Work around the lack of EFTYPE and protect <err.h>.

8 years agoNow that our man.conf(5) format is mature and extremely simple,
Ingo Schwarze [Tue, 19 Jul 2016 22:40:33 +0000 (22:40 +0000)]
Now that our man.conf(5) format is mature and extremely simple,
delete manpath(1) support.  With the mandoc-based man(1), manpath(1)
is utterly useless.  Just set MANPATH_DEFAULT in configure.local
for sane operating system defaults, use man.conf(5) for machine-
specific modifications, and use ${MANPATH}, -m, and -M for user
preferences.

8 years agoRemove the dependency on SQLite without loss of functionality.
Ingo Schwarze [Tue, 19 Jul 2016 21:31:55 +0000 (21:31 +0000)]
Remove the dependency on SQLite without loss of functionality.
Stop supporting systems that don't have mmap(3).
Drop the obsolete names_check() now that we deleted MLINKS.

8 years agoRemove one outdated comment and fix one typo
Ingo Schwarze [Tue, 19 Jul 2016 17:56:04 +0000 (17:56 +0000)]
Remove one outdated comment and fix one typo
noted by Jan Stary <hans at stare dot cz>.

8 years agoSince the mdoc/man parser unification, the parser is always allocated
Ingo Schwarze [Tue, 19 Jul 2016 16:22:52 +0000 (16:22 +0000)]
Since the mdoc/man parser unification, the parser is always allocated
in mparse_alloc(), so delete all the curp->man == NULL checks.
Triggered by a patch from Christos Zoulas suggesting to add
yet another such check.

8 years agoUse __attribute__((__format__ throughout.
Ingo Schwarze [Tue, 19 Jul 2016 13:36:13 +0000 (13:36 +0000)]
Use __attribute__((__format__ throughout.
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.

8 years agocope with -Wmissing-prototypes
Ingo Schwarze [Mon, 18 Jul 2016 18:35:05 +0000 (18:35 +0000)]
cope with -Wmissing-prototypes

8 years agoTo remove the const qualifier from a pointer to an object - either
Ingo Schwarze [Fri, 15 Jul 2016 19:33:01 +0000 (19:33 +0000)]
To remove the const qualifier from a pointer to an object - either
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@.

8 years agoFix previous: the mandocdb() prototype was already there, it just
Ingo Schwarze [Fri, 15 Jul 2016 18:50:20 +0000 (18:50 +0000)]
Fix previous: the mandocdb() prototype was already there, it just
hid among static functions, as noticed by tedu@ (my bad).

8 years agoadd missing prototypes, no code change;
Ingo Schwarze [Fri, 15 Jul 2016 18:03:45 +0000 (18:03 +0000)]
add missing prototypes, no code change;
noticed by Christos Zoulas with -Wmissing-prototypes

8 years agoSanitize the environment when calling make(1) to autodetect ${CC}.
Ingo Schwarze [Fri, 15 Jul 2016 15:08:37 +0000 (15:08 +0000)]
Sanitize the environment when calling make(1) to autodetect ${CC}.
Sevan Janiyan found during testing on AIX that ${CC} could leak in.

8 years agofinal 1.13.4 release notes VERSION_1_13_4
Ingo Schwarze [Thu, 14 Jul 2016 11:09:06 +0000 (11:09 +0000)]
final 1.13.4 release notes

8 years agoAdd support for Mac OS X's sandbox_init(3) sandbox functionality, which
Kristaps Dzonsons [Tue, 12 Jul 2016 05:18:38 +0000 (05:18 +0000)]
Add support for Mac OS X's sandbox_init(3) sandbox functionality, which
is marked as DEPRECATED in OS X after 2011 or so, but has not been
removed and has no replacement.

ok schwarze@

8 years agoMake all components of the URI individually optional,
Ingo Schwarze [Mon, 11 Jul 2016 22:48:37 +0000 (22:48 +0000)]
Make all components of the URI individually optional,
independent of each other, as in:
http://man.openbsd.org[/manpath][/mansec][/arch]/name[.sec]
The restrictions in the past kept confusing people.
Triggered by a question from RafaelNeves at gmail dot com.

8 years agosupport LDFLAGS;
Ingo Schwarze [Sun, 10 Jul 2016 18:24:23 +0000 (18:24 +0000)]
support LDFLAGS;
suggested by Christian Neukirchen <chneukirchen at gmail dot com>

8 years agoOn OpenBSD, more(1) is actually less(1) with a small number of
Ingo Schwarze [Sun, 10 Jul 2016 14:05:13 +0000 (14:05 +0000)]
On OpenBSD, more(1) is actually less(1) with a small number of
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>.

8 years agoFix a nasty typo that prevented .so links to gziped manuals
Ingo Schwarze [Sun, 10 Jul 2016 13:34:30 +0000 (13:34 +0000)]
Fix a nasty typo that prevented .so links to gziped manuals
from working in the absence of a mandoc.db(5) database.
Found the hard way by Svyatoslav Mishyn on Crux Linux.

8 years agoSimplify the code and the server setup by deleting the pseudo-manpath
Ingo Schwarze [Sun, 10 Jul 2016 10:05:33 +0000 (10:05 +0000)]
Simplify the code and the server setup by deleting the pseudo-manpath
"mandoc" that was used for man.cgi(8) documentation and by assuming
that the apropos(1) and man.cgi(8) manuals are simply installed in
the default manpath.  Even though man.cgi(8) is not installed by
default when installing OpenBSD, it is easy to copy it into the
default manpath used for man.cgi(8).

Idea found when considering a question asked by wrant dot com.

8 years agoDo not treat PATH_INFO as a complete path if it doesn't contain
Ingo Schwarze [Sat, 9 Jul 2016 19:58:36 +0000 (19:58 +0000)]
Do not treat PATH_INFO as a complete path if it doesn't contain
a manpath.  For example, this makes http://man.openbsd.org/mandoc
work as expected.
Bug reported by tb@, reminded by Svyatoslav Mishyn.

8 years agogetopt(3) is declared in <unistd.h>, and <getopt.h> is not needed;
Ingo Schwarze [Sat, 9 Jul 2016 15:24:19 +0000 (15:24 +0000)]
getopt(3) is declared in <unistd.h>, and <getopt.h> is not needed;
from Joerg Sonnenberger via Thomas Klausner, NetBSD.

8 years agoISO C99 7.19.2.5 doesn't like mixing putchar(3) and putwchar(3) on
Ingo Schwarze [Fri, 8 Jul 2016 22:29:05 +0000 (22:29 +0000)]
ISO C99 7.19.2.5 doesn't like mixing putchar(3) and putwchar(3) on
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.

8 years agoA some missing files to TESTSRCS and DISTFILES
Ingo Schwarze [Fri, 8 Jul 2016 20:46:10 +0000 (20:46 +0000)]
A some missing files to TESTSRCS and DISTFILES
and add a trivial "dist" target for convenience.

8 years agoPOSIX requires that a process calling tcsetpgrp(3) from the background
Ingo Schwarze [Fri, 8 Jul 2016 20:42:15 +0000 (20:42 +0000)]
POSIX requires that a process calling tcsetpgrp(3) from the background
gets a SIGTTOU signal.  In that case, do not stop.
Portability issue found while testing on commercial Solaris 9/10/11.
Thanks to opencsw.org for providing me with a testing environment.

8 years agosome 1.13.4 release preparations
Ingo Schwarze [Thu, 7 Jul 2016 23:46:36 +0000 (23:46 +0000)]
some 1.13.4 release preparations

8 years agoupdate developer documentation
Ingo Schwarze [Thu, 7 Jul 2016 19:19:01 +0000 (19:19 +0000)]
update developer documentation

8 years agosync with OpenBSD: do not mention mansearch(3), which is not installed,
Ingo Schwarze [Thu, 7 Jul 2016 14:35:48 +0000 (14:35 +0000)]
sync with OpenBSD: do not mention mansearch(3), which is not installed,
in a manual which is installed

8 years agosync with OpenBSD: do not talk about nginx(8)
Ingo Schwarze [Thu, 7 Jul 2016 14:34:41 +0000 (14:34 +0000)]
sync with OpenBSD: do not talk about nginx(8)

8 years agoUpdate and simplify the documentation of the -s option,
Ingo Schwarze [Fri, 1 Jul 2016 20:24:04 +0000 (20:24 +0000)]
Update and simplify the documentation of the -s option,
which was forgotten when implementing the new man.conf(5) format.
The outdated information was originally pointed out
by Andy Bradford <amb dash openbsd at bradfords dot org> on misc@.
OK jmc@

8 years agodelete two entries that are done
Ingo Schwarze [Sun, 5 Jun 2016 21:06:04 +0000 (21:06 +0000)]
delete two entries that are done

8 years agoTrim trailing whitespace from man.conf lines; patch from millert@.
Ingo Schwarze [Sat, 28 May 2016 13:44:13 +0000 (13:44 +0000)]
Trim trailing whitespace from man.conf lines; patch from millert@.

8 years agoSimplify search form: minus two visible control elements, minus
Ingo Schwarze [Sat, 28 May 2016 13:40:48 +0000 (13:40 +0000)]
Simplify search form: minus two visible control elements, minus
one table, minus twenty lines of code, no loss of functionality.
No idea why i didn't do this earlier...

8 years agoDelete useless variables that could sneak into the Makefile
Ingo Schwarze [Wed, 18 May 2016 23:51:16 +0000 (23:51 +0000)]
Delete useless variables that could sneak into the Makefile
behind the user's back, dangerously bypassing ./configure.
Leakage reported by Peter Bray <pdb_ml at yahoo dot com dot au>.

8 years agoDo not hardcode "makewhatis" in a warning message, use BINM_MAKEWHATIS.
Ingo Schwarze [Wed, 18 May 2016 22:36:00 +0000 (22:36 +0000)]
Do not hardcode "makewhatis" in a warning message, use BINM_MAKEWHATIS.
Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.

8 years agoVarious people (among others Maxim Belooussov and Carsten Kunze)
Ingo Schwarze [Wed, 18 May 2016 21:37:04 +0000 (21:37 +0000)]
Various people (among others Maxim Belooussov and Carsten Kunze)
reported that the build system still assumed that ohash is only
needed if sqlite3 is also in use, which is no longer true:
The ohash library is now required no matter what.

Rework sqlite3 and ohash library autodetection
such that both work independently of each other.
Provide LDADD for additional linker flags.
Add some missing variables to configure.local.example.

8 years agoLinux needs <stddef.h>, or NULL isn't defined.
Ingo Schwarze [Wed, 18 May 2016 20:43:32 +0000 (20:43 +0000)]
Linux needs <stddef.h>, or NULL isn't defined.

8 years agoOnly focus on the query input box when no manual page is displayed,
Ingo Schwarze [Fri, 29 Apr 2016 10:45:36 +0000 (10:45 +0000)]
Only focus on the query input box when no manual page is displayed,
that is, for the index page, for the noresult page, and for the
result of an apropos(1) query with more than one page.
As noted by bentley@, when a manual page is displayed, it is more
important that people can quickly use the space bar for paging and
Ctrl-F for searching.

8 years agoSet the "autofocus" attribute on the query text box.
Ingo Schwarze [Thu, 28 Apr 2016 17:59:14 +0000 (17:59 +0000)]
Set the "autofocus" attribute on the query text box.
Patch from Fabian dot Raetz at gmail dot com.

8 years agoset up man.cgi(3) for inclusion in the web site
Ingo Schwarze [Fri, 15 Apr 2016 21:20:11 +0000 (21:20 +0000)]
set up man.cgi(3) for inclusion in the web site

8 years agodocument the internals of cgi.c for developers;
Ingo Schwarze [Fri, 15 Apr 2016 21:16:22 +0000 (21:16 +0000)]
document the internals of cgi.c for developers;
not intended to be installed

8 years agoRename five static functions to make the classification of functions
Ingo Schwarze [Fri, 15 Apr 2016 21:14:51 +0000 (21:14 +0000)]
Rename five static functions to make the classification of functions
as parsers, page generators, and result generators more obvious.
No functional change.

8 years agoprefer warn[x](3) over fprintf(3) where appropriate
Ingo Schwarze [Fri, 15 Apr 2016 16:42:52 +0000 (16:42 +0000)]
prefer warn[x](3) over fprintf(3) where appropriate

8 years agoFix parsing of PATH_INFO if both a section directory and an
Ingo Schwarze [Fri, 15 Apr 2016 15:13:07 +0000 (15:13 +0000)]
Fix parsing of PATH_INFO if both a section directory and an
architecture subdirectory are specified.  Issue reported by tb@.

8 years agoMake HTML tags lower case for better stylistic agreement with what
Ingo Schwarze [Fri, 15 Apr 2016 01:34:51 +0000 (01:34 +0000)]
Make HTML tags lower case for better stylistic agreement with what
html.c does.

8 years agoIn the architectures dropdown, move aviion, ia64, solbourne, and vax
Ingo Schwarze [Fri, 15 Apr 2016 00:51:59 +0000 (00:51 +0000)]
In the architectures dropdown, move aviion, ia64, solbourne, and vax
down to the currently unsupported entries.

8 years agoIf PATH_INFO contains a complete and correct path to a manual page
Ingo Schwarze [Fri, 15 Apr 2016 00:37:50 +0000 (00:37 +0000)]
If PATH_INFO contains a complete and correct path to a manual page
file, for example "/OpenBSD-5.9/man2/pledge.2", no database query
is needed and the file is delivered directly.

But even in this case, let's parse the PATH_INFO and fill the query
structure such that the search form at the top of the result page
gets pre-filled with useful values.

8 years agoomit list of other results when there is only one match
Ingo Schwarze [Fri, 15 Apr 2016 00:14:17 +0000 (00:14 +0000)]
omit list of other results when there is only one match

8 years agofor .Xr links, use short PATH_INFO style URIs
Ingo Schwarze [Thu, 14 Apr 2016 23:48:48 +0000 (23:48 +0000)]
for .Xr links, use short PATH_INFO style URIs

8 years agoFix a process group race.
Ingo Schwarze [Thu, 14 Apr 2016 20:55:48 +0000 (20:55 +0000)]
Fix a process group race.

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@.

8 years agodo not rewrite short queries
Ingo Schwarze [Thu, 14 Apr 2016 20:40:33 +0000 (20:40 +0000)]
do not rewrite short queries

8 years agoin -man -Thtml, .nf does not preserve indentation
Ingo Schwarze [Thu, 14 Apr 2016 11:16:04 +0000 (11:16 +0000)]
in -man -Thtml, .nf does not preserve indentation

8 years agoGive manuals in purely numerical sections priority over manuals of
Ingo Schwarze [Wed, 13 Apr 2016 15:38:45 +0000 (15:38 +0000)]
Give manuals in purely numerical sections priority over manuals of
the same name in sections with an alphabetical suffix; same logic
as in main.c rev. 1.264.

8 years agoGive manuals in purely numerical sections priority over manuals of
Ingo Schwarze [Wed, 13 Apr 2016 12:26:25 +0000 (12:26 +0000)]
Give manuals in purely numerical sections priority over manuals of
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.

8 years agofix error page indentation:
Ingo Schwarze [Wed, 13 Apr 2016 10:19:23 +0000 (10:19 +0000)]
fix error page indentation:
negative indent for h1 only in div.section
issue reported by mikeb@

8 years agosed 's/the the/the/' in a comment; from krw@
Ingo Schwarze [Tue, 12 Apr 2016 15:30:00 +0000 (15:30 +0000)]
sed 's/the the/the/' in a comment; from krw@

8 years agodouble word; from jmc@
Ingo Schwarze [Sat, 19 Mar 2016 13:29:22 +0000 (13:29 +0000)]
double word; from jmc@

8 years agoMake the SCRIPT_NAME logic simpler, safer, and make it actually work;
Ingo Schwarze [Fri, 18 Mar 2016 13:22:27 +0000 (13:22 +0000)]
Make the SCRIPT_NAME logic simpler, safer, and make it actually work;
in part based on ideas by bentley@.
While here, improve the documentation.

8 years agodocument short URIs
Ingo Schwarze [Fri, 18 Mar 2016 01:22:56 +0000 (01:22 +0000)]
document short URIs

8 years agomake man(1) mode the default rather than apropos(1) mode
Ingo Schwarze [Thu, 17 Mar 2016 22:06:44 +0000 (22:06 +0000)]
make man(1) mode the default rather than apropos(1) mode

8 years ago'accomodate' -> 'accommodate' in a comment.
Ingo Schwarze [Thu, 17 Mar 2016 21:26:26 +0000 (21:26 +0000)]
'accomodate' -> 'accommodate' in a comment.
From krw@, started by a diff from Mical Mazurek.

8 years agosupport short URIs for man.openbsd.org
Ingo Schwarze [Thu, 17 Mar 2016 21:22:59 +0000 (21:22 +0000)]
support short URIs for man.openbsd.org

9 years agounbreak reading from stdin after recent parse() restructuring;
Ingo Schwarze [Sat, 16 Jan 2016 22:30:33 +0000 (22:30 +0000)]
unbreak reading from stdin after recent parse() restructuring;
patch from florian@

9 years agoDelete the redundant "nchild" member of struct roff_node, replacing
Ingo Schwarze [Fri, 8 Jan 2016 17:48:09 +0000 (17:48 +0000)]
Delete the redundant "nchild" member of struct roff_node, replacing
most uses by one, a few by two pointer checks, and only one by a
tiny loop - not only making data smaller, but code shorter as well.

This gets rid of an implicit invariant that confused both static
analysis tools and human auditors.  No functional change.