CVS log for mandoc/cgi.c

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.181 / (download) - annotate - [select for diffs], Fri Apr 28 19:11:03 2023 UTC (11 months ago) by schwarze
Branch: MAIN
CVS Tags: HEAD
Changes since 1.180: +2 -2 lines
Diff to previous 1.180 (colored) to selected 1.90 (colored)

spelling fixes from Paul Tagliamonte via tech@ and jmc@

Revision 1.180 / (download) - annotate - [select for diffs], Wed Jul 6 17:21:04 2022 UTC (20 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.179: +7 -5 lines
Diff to previous 1.179 (colored) to selected 1.90 (colored)

For accessibility, label the last two widgets in the search form.
Patch from Anna Vyalkova <cyber at sysrq dot in>, significantly tweaked by me.

Revision 1.179 / (download) - annotate - [select for diffs], Wed Jul 6 16:05:40 2022 UTC (20 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.178: +4 -4 lines
Diff to previous 1.178 (colored) to selected 1.90 (colored)

https://www.w3.org/WAI/ARIA/apg/practices/names-and-descriptions/ says:
"Start names with a capital letter;
it helps some screen readers speak them with appropriate inflection."
Anna Vyalkova already did that correctly when sending patches,
but i ruined it when committing, so fix it now.

Revision 1.178 / (download) - annotate - [select for diffs], Tue Jul 5 14:04:25 2022 UTC (20 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.177: +43 -31 lines
Diff to previous 1.177 (colored) to selected 1.90 (colored)

Somehow, the content of header.html ended up
before and outside the <header> element.
Fix this by moving it into the <header> element where it belongs.
While here, also wrap footer.html in a <footer> element.

Revision 1.177 / (download) - annotate - [select for diffs], Mon Jul 4 16:20:42 2022 UTC (20 months, 3 weeks ago) by schwarze
Branch: MAIN
Changes since 1.176: +33 -16 lines
Diff to previous 1.176 (colored) to selected 1.90 (colored)

Improve accessibility of man.cgi(8) in various respects,
in particular adding <header>, <main>, and <nav> elements
and role and aria-label attributes in several places.
Patch from Anna Vyalkova <cyber at sysrq dot in>,
minimally tweaked by me.

Revision 1.176 / (download) - annotate - [select for diffs], Fri Nov 5 17:04:10 2021 UTC (2 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.175: +2 -2 lines
Diff to previous 1.175 (colored) to selected 1.90 (colored)

Commit and commit message by deraadt@:
For open/openat, if the flags parameter does not contain O_CREAT, the
3rd (variadic) mode_t parameter is irrelevant.  Many developers in the past
have passed mode_t (0, 044, 0644, or such), which might lead future people
to copy this broken idiom, and perhaps even believe this parameter has some
meaning or implication or application. Delete them all.
This comes out of a conversation where tb@ noticed that a strange (but
intentional) pledge behaviour is to always knock-out high-bits from
mode_t on a number of system calls as a safety factor, and his bewilderment
that this appeared to be happening against valid modes (at least visually),
but no sorry, they are all irrelevant junk.  They could all be 0xdeafbeef.
ok millert

Revision 1.175 / (download) - annotate - [select for diffs], Thu Aug 19 15:23:36 2021 UTC (2 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6
Changes since 1.174: +25 -9 lines
Diff to previous 1.174 (colored) to selected 1.90 (colored)

fix the section number in the <title> element for preformatted pages;
minibug reported by Ian <Ropers at gmail dot com> on misc@

Revision 1.174 / (download) - annotate - [select for diffs], Thu May 13 13:33:11 2021 UTC (2 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.173: +4 -3 lines
Diff to previous 1.173 (colored) to selected 1.90 (colored)

Add OpenBSD riscv64 architecture; patch from jsg@.
While here, retire sgi and socppc.

Revision 1.173 / (download) - annotate - [select for diffs], Mon Jun 29 19:22:09 2020 UTC (3 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.172: +6 -5 lines
Diff to previous 1.172 (colored) to selected 1.90 (colored)

Support the "powerpc64" architecture name.
The first file using it in .Dt was just committed by kettenis@.

Revision 1.172 / (download) - annotate - [select for diffs], Fri Apr 3 11:35:01 2020 UTC (3 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.171: +6 -4 lines
Diff to previous 1.171 (colored) to selected 1.90 (colored)

Remove some stray argument names from function prototypes,
for consistency with the dominant style used in mandoc.
No functional change.
Patch from Martin Vahlensieck <academicsolutions dot ch>.

Revision 1.171 / (download) - annotate - [select for diffs], Fri Jan 10 15:21:19 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.170: +3 -2 lines
Diff to previous 1.170 (colored) to selected 1.90 (colored)

autocapitalize=none; also from Tim Baumgard

Revision 1.170 / (download) - annotate - [select for diffs], Fri Jan 10 12:54:43 2020 UTC (4 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.169: +2 -2 lines
Diff to previous 1.169 (colored) to selected 1.90 (colored)

Switch off the useless and annoying "autocomplete" feature;
issue reported by Tim Baumgard <at bmgrd dot com>.
landry@ and florian@ agree with the general direction.

Revision 1.169 / (download) - annotate - [select for diffs], Sun Nov 10 22:35:25 2019 UTC (4 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.168: +3 -1 lines
Diff to previous 1.168 (colored) to selected 1.90 (colored)

Add a Content-Security-Policy HTTP header that allows only CSS.
This ensures that in a modern browser that understands the header,
mandoc rendering bugs cannot possibly be interpreted as JavaScript.
Patch from bentley@.

Revision 1.168 / (download) - annotate - [select for diffs], Tue Oct 1 17:54:14 2019 UTC (4 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.167: +11 -8 lines
Diff to previous 1.167 (colored) to selected 1.90 (colored)

For invalid queries and for valid queries returning no result,
return the appropriate 40x status code rather than 200.
Improvement suggested and diff tested
by John Gardner <gardnerjohng at gmail dot com>.

Revision 1.167 / (download) - annotate - [select for diffs], Wed Jul 10 12:49:20 2019 UTC (4 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.166: +1 -2 lines
Diff to previous 1.166 (colored) to selected 1.90 (colored)

in man.cgi(8), disable -O toc by default; requested by deraadt@

Revision 1.166 / (download) - annotate - [select for diffs], Wed Mar 6 12:32:41 2019 UTC (5 years ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5
Changes since 1.165: +2 -2 lines
Diff to previous 1.165 (colored) to selected 1.90 (colored)

drop redundant '0' flag from "%02.2X" format string;
found by a compiler warning from gcc 4.9.2 on Linux

Revision 1.165 / (download) - annotate - [select for diffs], Thu Jan 31 23:00:23 2019 UTC (5 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.164: +2 -2 lines
Diff to previous 1.164 (colored) to selected 1.90 (colored)

Relax overzealous PATH_INFO validation.
URIs like https://man.openbsd.org/OpenBSD-2.2/cat1/cat.0
are still required to work because they result from apropos searches for
old releases (up to 5.0) which used to install preformatted manual pages.
Regression reported by jj@.

Revision 1.164 / (download) - annotate - [select for diffs], Sun Dec 30 00:49:54 2018 UTC (5 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.163: +9 -21 lines
Diff to previous 1.163 (colored) to selected 1.90 (colored)

Cleanup, no functional change:

The struct roff_man used to be a bad mixture of internal parser
state and public parsing results.  Move the public results to the
parsing result struct roff_meta, which is already public.  Move the
rest of struct roff_man to the parser-internal header roff_int.h.

Since the validators need access to the parser state, call them
from the top level parser during mparse_result() rather than from
the main programs, also reducing code duplication.

This keeps parser internal state out of thee main programs (five
in mandoc portable) and out of eight formatters.

Revision 1.163 / (download) - annotate - [select for diffs], Fri Dec 14 01:18:25 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.162: +2 -2 lines
Diff to previous 1.162 (colored) to selected 1.90 (colored)

Major cleanup; may imply minor changes in edge cases of error reporting.

Finally, drop support for the run-time configurable mandocmsg()
callback.  It was over-engineered from the start, never used for
anything in a decade, and repeatedly caused maintenance headaches.

Consolidate reporting infrastructure into two files, mandoc.h and
mandoc_msg.c, mopping up the bits and pieces that were scattered
around main.c, read.c, mandoc_parse.h, libmandoc.h, the prototypes
of four parsing-related functions, and both parser structs.

Revision 1.162 / (download) - annotate - [select for diffs], Thu Dec 13 11:55:46 2018 UTC (5 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.161: +2 -1 lines
Diff to previous 1.161 (colored) to selected 1.90 (colored)

Cleanup, no functional change:
Split the top level parser interface out of the utility header
mandoc.h, into a new header mandoc_parse.h, for use in the main
program and in the main parser only.
Move enum mandoc_os into roff.h because struct roff_man is the
place where it is stored.
This allows removal of mandoc.h from seven files in low-level
parsers and in formatters.

Revision 1.161 / (download) - annotate - [select for diffs], Fri Oct 19 21:10:56 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.160: +41 -47 lines
Diff to previous 1.160 (colored) to selected 1.90 (colored)

Rewrite parse_path_info() to be four lines shorter, simplify ownership
of allocated strings, do not write to the input string, and improve
diagnostic output.

The confusing error message "invalid arch" as a reaction to mistyping
the release name was noticed by tb@, who likes the new code and message.

Revision 1.160 / (download) - annotate - [select for diffs], Tue Oct 2 19:41:23 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.159: +3 -2 lines
Diff to previous 1.159 (colored) to selected 1.90 (colored)

enable the equivalent of -O toc in man.cgi(8)

Revision 1.159 / (download) - annotate - [select for diffs], Mon Oct 1 08:06:53 2018 UTC (5 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.158: +33 -5 lines
Diff to previous 1.158 (colored) to selected 1.90 (colored)

Add missing URI encoding when writing HTTP redirects,
fixing a bug reported by <jungleboogie0 at gmail dot com> on bugs@.
While here, fully validate the arch name
such that we do not have to URI encode that one.

Revision 1.158 / (download) - annotate - [select for diffs], Tue May 29 20:32:45 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_4
Changes since 1.157: +6 -8 lines
Diff to previous 1.157 (colored) to selected 1.90 (colored)

Remove redundant value= attributes from option elements,
and use type=search rather than type=text for the input element
because it tends to better support autocompletion.
Both suggested by John Gardner <gardnerjohng at gmail dot com>.

Revision 1.157 / (download) - annotate - [select for diffs], Fri May 18 14:23:00 2018 UTC (5 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.156: +3 -1 lines
Diff to previous 1.156 (colored) to selected 1.90 (colored)

In a nutshell, all mobile browsers are broken.
By default, no matter the physical screen size, they use a fixed
viewport width of about 1000px, then scale down the rendered page
to make that huge viewport fit on the physical screen.
That results in poor rendering for bad websites which assume a
large fixed-size viewport (typically requiring zooming in to be able
to actually read any text), but in atrocious rendering for good
websites that make no assumption about the screen size (unreadably
small text in the top left corner, most of the screen empty).

A standard way to disable that insane behaviour and just render
normally on the actual physical screen size does not exist.
The closest thing is the CSS3 Device Adaptation Module Level 1
https://drafts.csswg.org/css-device-adapt/
but https://caniuse.com/#feat=css-deviceadaptation tells me
that basically no browser implements it, not even on mobile.

The next closest thing is the HTML meta viewport element - even though
the problem has nothing to do with HTML and is purely a CSS issue.
Standardization is not even planned for that one:
* HTML 5.2 mentions it in passing without specifying it:
https://www.w3.org/TR/html/document-metadata.html#the-meta-element
* The Web Hypertext Application Technology Working Group
provides very incomplete information:
https://wiki.whatwg.org/wiki/MetaExtensions
* CSS3 Device Adaptation Module Level 1 already wants to deprecate it,
explaining mostly how to migrate *away* from it to some castle in
the sky that no browser implements:
https://drafts.csswg.org/css-device-adapt/#viewport-meta

While i strongly believe in sticking to well-established standards,
in the absence of standards and with atrocious behaviour being
universal, there appears to be no alternative to using whatever
works.  The meta viewport element appears to be the only way to
make real-world mobile browsers decently render any HTML page that
does not have a fixed-width layout of 1000px.  So use it, grudgingly.

Originally suggested by xcv at dr dot com.
Direction supported by espie@.

Revision 1.156 / (download) - annotate - [select for diffs], Sat Jun 24 14:38:32 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.155: +2 -2 lines
Diff to previous 1.155 (colored) to selected 1.90 (colored)

Split -Wstyle into -Wstyle and the even lower -Wbase, and add
-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@.

Revision 1.155 / (download) - annotate - [select for diffs], Tue Jun 20 17:24:35 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
Changes since 1.154: +5 -5 lines
Diff to previous 1.154 (colored) to selected 1.90 (colored)

KNF: remove parentheses from switch case labels; no binary change

Revision 1.154 / (download) - annotate - [select for diffs], Wed Apr 19 01:00:03 2017 UTC (6 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.153: +3 -2 lines
Diff to previous 1.153 (colored) to selected 1.90 (colored)

More thoroughly reject direct access to unintended files, such that
URIs like http://man.openbsd.org/OpenBSD-current/mandoc.db and
http://man.openbsd.org/OpenBSD-current/man1/ do not cause display
of garbage.

Revision 1.153 / (download) - annotate - [select for diffs], Sat Mar 18 16:48:24 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.152: +12 -11 lines
Diff to previous 1.152 (colored) to selected 1.90 (colored)

Simplify: write HTTP 303 redirects with relative locations.
Suggested by bentley@.

Delete the HTTP_HOST configuration variable that is now obsolete.

Revision 1.152 / (download) - annotate - [select for diffs], Sat Mar 18 16:19:11 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.151: +3 -2 lines
Diff to previous 1.151 (colored) to selected 1.90 (colored)

Bugfix: use SCRIPT_NAME for .Xr hyperlinks.
Patch from <andreas at AndreasVoegele dot com>.

Revision 1.151 / (download) - annotate - [select for diffs], Wed Mar 15 13:49:50 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.150: +7 -4 lines
Diff to previous 1.150 (colored) to selected 1.90 (colored)

In URIs in apropos(1) result tables,
only write the manpath if it does not match the default.

Revision 1.150 / (download) - annotate - [select for diffs], Wed Mar 15 13:18:53 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.149: +49 -34 lines
Diff to previous 1.149 (colored) to selected 1.90 (colored)

Mention the manual page name and section in the HTML page <title>.
Based on a patch from <Anton dot Lindqvist at gmail dot com>,
but simplified and also covering apropos(1) search results.

Revision 1.149 / (download) - annotate - [select for diffs], Wed Mar 15 10:17:29 2017 UTC (7 years ago) by schwarze
Branch: MAIN
Changes since 1.148: +25 -3 lines
Diff to previous 1.148 (colored) to selected 1.90 (colored)

It's annoying that people keep writing URIs including redundant parts
like "/OpenBSD-current/manN/".  To discourage that, let man.cgi(8)
redirect search form results to nice, concise URIs.

Revision 1.148 / (download) - annotate - [select for diffs], Wed Feb 22 16:20:01 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
Changes since 1.147: +17 -1 lines
Diff to previous 1.147 (colored) to selected 1.90 (colored)

Pledge man.cgi(8).
Based on a more complicated patch from semarie@.
Sebastien and tb@ both agree with the simplification.

Revision 1.147 / (download) - annotate - [select for diffs], Wed Feb 8 13:34:27 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13
Changes since 1.146: +3 -1 lines
Diff to previous 1.146 (colored) to selected 1.90 (colored)

protect <err.h> inclusion

Revision 1.146 / (download) - annotate - [select for diffs], Wed Jan 25 03:49:38 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.145: +2 -2 lines
Diff to previous 1.145 (colored) to selected 1.90 (colored)

add arm64 architecture; from deraadt@

Revision 1.145 / (download) - annotate - [select for diffs], Wed Jan 25 02:14:43 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.144: +3 -1 lines
Diff to previous 1.144 (colored) to selected 1.90 (colored)

Improve HTML formatting of .Bl -tag.

In particular, when using the style sheet, put the body on the same
line as the head for short heads, or on the next line for long
heads, in a way that preserves both correct indentation and correct
vertical spacing with and without -compact, and with one or more
heads per body (hi, Zaphod) - eight use cases so far - and with and
without -tag, and with and without -offset, 32 use cases grand total.

Using many ideas from zhuk@, from <David dot Dahlberg at fkie dot
fraunhofer dot de>, and from Benny Lofgren <bl dash lists at lofgren
dot biz>, and a few of my own.

This is an excellent demonstration that CSS is an extremely hostile
language, much more trapful and much harder to use than, say, C.
When matthew@ reported this in July 2014 (!), it was already a known
issue, and i no longer remember for how long.  My first serious
attempt at fixing it (in November 2015) failed miserably.  I'd love
to see simplifications of both the generated HTML code and of the
style sheet, but without breaking any of the 32 use cases, please.

Revision 1.144 / (download) - annotate - [select for diffs], Sat Jan 21 01:20:31 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.143: +9 -14 lines
Diff to previous 1.143 (colored) to selected 1.90 (colored)

clean up the remaining class attributes

Revision 1.143 / (download) - annotate - [select for diffs], Thu Jan 19 13:55:56 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.142: +27 -27 lines
Diff to previous 1.142 (colored) to selected 1.90 (colored)

Adjust indentation of the HTML output to the conventions established
by html.c.  No semantic change.

Revision 1.142 / (download) - annotate - [select for diffs], Thu Jan 19 13:35:02 2017 UTC (7 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.141: +5 -10 lines
Diff to previous 1.141 (colored) to selected 1.90 (colored)

Start cleanup: trim useless HTML comments, <div> elements,
and CSS rules on the <html> and <body> levels.

Revision 1.141 / (download) - annotate - [select for diffs], Mon Sep 12 00:06:20 2016 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.140: +2 -2 lines
Diff to previous 1.140 (colored) to selected 1.90 (colored)

use the proper HTML escape for double quote ("): &quot; not &quote;
patch from bentley@

Revision 1.140 / (download) - annotate - [select for diffs], Sat Sep 3 21:24:56 2016 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.139: +4 -4 lines
Diff to previous 1.139 (colored) to selected 1.90 (colored)

move zaurus down to the discontinued architectures

Revision 1.139 / (download) - annotate - [select for diffs], Thu Sep 1 15:07:24 2016 UTC (7 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.138: +4 -4 lines
Diff to previous 1.138 (colored) to selected 1.90 (colored)

move "sparc" down to discontinued architectures

Revision 1.138 / (download) - annotate - [select for diffs], Thu Aug 18 09:02:34 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.137: +2 -1 lines
Diff to previous 1.137 (colored) to selected 1.90 (colored)

fix an fd leak; patch from jsg@

Revision 1.137 / (download) - annotate - [select for diffs], Wed Aug 10 18:39:23 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.136: +6 -5 lines
Diff to previous 1.136 (colored) to selected 1.90 (colored)

move armish and hppa64 down in the dropdown box; reminded by jmc@

Revision 1.136 / (download) - annotate - [select for diffs], Sun Jul 31 23:37:23 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.135: +3 -2 lines
Diff to previous 1.135 (colored) to selected 1.90 (colored)

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

Revision 1.135 / (download) - annotate - [select for diffs], Mon Jul 11 22:48:37 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.134: +42 -17 lines
Diff to previous 1.134 (colored) to selected 1.90 (colored)

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.

Revision 1.134 / (download) - annotate - [select for diffs], Sun Jul 10 10:05:33 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.133: +4 -12 lines
Diff to previous 1.133 (colored) to selected 1.90 (colored)

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.

Revision 1.133 / (download) - annotate - [select for diffs], Sat Jul 9 19:58:36 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.132: +2 -2 lines
Diff to previous 1.132 (colored) to selected 1.90 (colored)

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.

Revision 1.132 / (download) - annotate - [select for diffs], Sat May 28 13:40:48 2016 UTC (7 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.131: +9 -28 lines
Diff to previous 1.131 (colored) to selected 1.90 (colored)

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

Revision 1.131 / (download) - annotate - [select for diffs], Fri Apr 29 10:45:36 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.130: +18 -9 lines
Diff to previous 1.130 (colored) to selected 1.90 (colored)

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.

Revision 1.130 / (download) - annotate - [select for diffs], Thu Apr 28 17:59:14 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (colored) to selected 1.90 (colored)

Set the "autofocus" attribute on the query text box.
Patch from Fabian dot Raetz at gmail dot com.

Revision 1.129 / (download) - annotate - [select for diffs], Fri Apr 15 21:14:51 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.128: +16 -16 lines
Diff to previous 1.128 (colored) to selected 1.90 (colored)

Rename five static functions to make the classification of functions
as parsers, page generators, and result generators more obvious.
No functional change.

Revision 1.128 / (download) - annotate - [select for diffs], Fri Apr 15 16:42:52 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.127: +19 -23 lines
Diff to previous 1.127 (colored) to selected 1.90 (colored)

prefer warn[x](3) over fprintf(3) where appropriate

Revision 1.127 / (download) - annotate - [select for diffs], Fri Apr 15 15:13:07 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.126: +14 -18 lines
Diff to previous 1.126 (colored) to selected 1.90 (colored)

Fix parsing of PATH_INFO if both a section directory and an
architecture subdirectory are specified.  Issue reported by tb@.

Revision 1.126 / (download) - annotate - [select for diffs], Fri Apr 15 01:34:51 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.125: +97 -97 lines
Diff to previous 1.125 (colored) to selected 1.90 (colored)

Make HTML tags lower case for better stylistic agreement with what
html.c does.

Revision 1.125 / (download) - annotate - [select for diffs], Fri Apr 15 00:51:59 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.124: +10 -10 lines
Diff to previous 1.124 (colored) to selected 1.90 (colored)

In the architectures dropdown, move aviion, ia64, solbourne, and vax
down to the currently unsupported entries.

Revision 1.124 / (download) - annotate - [select for diffs], Fri Apr 15 00:37:50 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.123: +4 -3 lines
Diff to previous 1.123 (colored) to selected 1.90 (colored)

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.

Revision 1.123 / (download) - annotate - [select for diffs], Fri Apr 15 00:14:17 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.122: +24 -21 lines
Diff to previous 1.122 (colored) to selected 1.90 (colored)

omit list of other results when there is only one match

Revision 1.122 / (download) - annotate - [select for diffs], Thu Apr 14 23:48:48 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.121: +3 -7 lines
Diff to previous 1.121 (colored) to selected 1.90 (colored)

for .Xr links, use short PATH_INFO style URIs

Revision 1.121 / (download) - annotate - [select for diffs], Thu Apr 14 20:40:33 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.120: +5 -2 lines
Diff to previous 1.120 (colored) to selected 1.90 (colored)

do not rewrite short queries

Revision 1.120 / (download) - annotate - [select for diffs], Wed Apr 13 15:38:45 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.119: +15 -13 lines
Diff to previous 1.119 (colored) to selected 1.90 (colored)

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.

Revision 1.119 / (download) - annotate - [select for diffs], Fri Mar 18 13:22:27 2016 UTC (8 years ago) by schwarze
Branch: MAIN
Changes since 1.118: +16 -24 lines
Diff to previous 1.118 (colored) to selected 1.90 (colored)

Make the SCRIPT_NAME logic simpler, safer, and make it actually work;
in part based on ideas by bentley@.
While here, improve the documentation.

Revision 1.118 / (download) - annotate - [select for diffs], Thu Mar 17 22:06:44 2016 UTC (8 years ago) by schwarze
Branch: MAIN
Changes since 1.117: +3 -2 lines
Diff to previous 1.117 (colored) to selected 1.90 (colored)

make man(1) mode the default rather than apropos(1) mode

Revision 1.117 / (download) - annotate - [select for diffs], Thu Mar 17 21:22:59 2016 UTC (8 years ago) by schwarze
Branch: MAIN
Changes since 1.116: +69 -9 lines
Diff to previous 1.116 (colored) to selected 1.90 (colored)

support short URIs for man.openbsd.org

Revision 1.116 / (download) - annotate - [select for diffs], Mon Jan 4 12:36:26 2016 UTC (8 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.115: +3 -56 lines
Diff to previous 1.115 (colored) to selected 1.90 (colored)

Don't retain the search query in the resulting manual links.
Clean, simple URLs are best.
Patch from bentley@.

Revision 1.115 / (download) - annotate - [select for diffs], Sat Nov 7 17:58:55 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.114: +23 -12 lines
Diff to previous 1.114 (colored) to selected 1.90 (colored)

Modernization, no functional change intended:
Use the POSIX function getline(3) rather than the slightly
dangerous BSD function fgetln(3).
Remove the related compatibility code.

Revision 1.114 / (download) - annotate - [select for diffs], Thu Nov 5 20:55:41 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.113: +20 -2 lines
Diff to previous 1.113 (colored) to selected 1.90 (colored)

Use include files "header.html" and "footer.html" rather than a
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.

Revision 1.113 / (download) - annotate - [select for diffs], Thu Nov 5 17:47:51 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.112: +3 -5 lines
Diff to previous 1.112 (colored) to selected 1.90 (colored)

Unify the three stylesheets into a single CSS file.
Many thanks to bentley@ for doing this work.

Revision 1.112 / (download) - annotate - [select for diffs], Thu Oct 22 22:06:43 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.111: +5 -2 lines
Diff to previous 1.111 (colored) to selected 1.90 (colored)

use the new function man_validate() here, too

Revision 1.111 / (download) - annotate - [select for diffs], Tue Oct 20 02:01:31 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.110: +5 -3 lines
Diff to previous 1.110 (colored) to selected 1.90 (colored)

In order to become able to generate syntax tree nodes on the roff(7)
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.

Revision 1.110 / (download) - annotate - [select for diffs], Tue Oct 13 22:59:54 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.109: +6 -8 lines
Diff to previous 1.109 (colored) to selected 1.90 (colored)

Major character table cleanup:
* 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.

Revision 1.109 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:19 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.108: +19 -19 lines
Diff to previous 1.108 (colored) to selected 1.90 (colored)

modernize style: "return" is not a function

Revision 1.108 / (download) - annotate - [select for diffs], Sat Apr 18 16:34:25 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.107: +7 -7 lines
Diff to previous 1.107 (colored) to selected 1.90 (colored)

Profit from the unified struct roff_man and reduce the number of
arguments of mparse_result() by one.  No functional change.
Written on the ICE Bruxelles-Koeln on the way back from p2k15.

Revision 1.107 / (download) - annotate - [select for diffs], Sat Apr 18 16:06:39 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.106: +3 -3 lines
Diff to previous 1.106 (colored) to selected 1.90 (colored)

Replace the structs mdoc and man by a unified struct roff_man.
Almost completely mechanical, no functional change.
Written on the train from Exeter to London returning from p2k15.

Revision 1.106 / (download) - annotate - [select for diffs], Fri Mar 27 21:33:20 2015 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.105: +8 -7 lines
Diff to previous 1.105 (colored) to selected 1.90 (colored)

Actually use the new man.conf(5) "output" directive.
Additional functionality, yet minus 45 lines of code.

Revision 1.105 / (download) - annotate - [select for diffs], Fri Mar 27 17:37:25 2015 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.104: +4 -4 lines
Diff to previous 1.104 (colored) to selected 1.90 (colored)

Parse the new man.conf(5) "output" directive.
The next step will be to actually use the parsed data.

Revision 1.104 / (download) - annotate - [select for diffs], Tue Feb 10 08:05:30 2015 UTC (9 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.103: +12 -12 lines
Diff to previous 1.103 (colored) to selected 1.90 (colored)

trim trailing white space, no code change;
from Svyatoslav Mishyn <juef at openmailboxd dot org>, Crux Linux

Revision 1.103 / (download) - annotate - [select for diffs], Thu Jan 15 04:26:39 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.102: +3 -11 lines
Diff to previous 1.102 (colored) to selected 1.90 (colored)

Fatal errors no longer exist.
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.

Revision 1.102 / (download) - annotate - [select for diffs], Wed Nov 26 17:55:27 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.101: +6 -12 lines
Diff to previous 1.101 (colored) to selected 1.90 (colored)

Make the code sipler and more robust by always assigning a value
to q.manpath and dropping the (incomplete) later NULL checks.

Revision 1.101 / (download) - annotate - [select for diffs], Tue Nov 11 19:04:55 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.100: +2 -1 lines
Diff to previous 1.100 (colored) to selected 1.90 (colored)

In man(1) mode without -a, stop searching after the first manual tree
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.

Revision 1.100 / (download) - annotate - [select for diffs], Tue Oct 28 17:36:19 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.99: +7 -3 lines
Diff to previous 1.99 (colored) to selected 1.90 (colored)

Make the character table available to libroff so it can check the
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.

Revision 1.99 / (download) - annotate - [select for diffs], Tue Oct 7 18:20:06 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.98: +3 -3 lines
Diff to previous 1.98 (colored) to selected 1.90 (colored)

be a bit more patient, 1s is sometimes insufficient for legitimate queries

Revision 1.98 / (download) - annotate - [select for diffs], Sat Sep 27 11:17:36 2014 UTC (9 years, 6 months ago) by kristaps
Branch: MAIN
Changes since 1.97: +3 -6 lines
Diff to previous 1.97 (colored) to selected 1.90 (colored)

Modify man.cgi to use HTML5.

Revision 1.97 / (download) - annotate - [select for diffs], Sun Sep 14 19:44:28 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.96: +33 -34 lines
Diff to previous 1.96 (colored) to selected 1.90 (colored)

Support backslash-escaping of white space in the query expression,
to be more similar to apropos(1) called from the shell.
Missing feature reported by Marcus MERIGHI <mcmer dash openbsd at
tor dot at> on misc@.

Revision 1.96 / (download) - annotate - [select for diffs], Tue Aug 26 11:21:40 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.95: +7 -7 lines
Diff to previous 1.95 (colored) to selected 1.90 (colored)

Sync section titles with OpenBSD.

For section 4, "Kernel Interfaces" is just too confusing,
the difference from sections 2 and 9 is too hard to see.

The 3p change was suggested by bluhm@; that part
of the manual describes more modules than functions.

Align the CGI section titles with the console section titles.

Revision 1.95 / (download) - annotate - [select for diffs], Thu Aug 21 16:05:21 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.94: +15 -1 lines
Diff to previous 1.94 (colored) to selected 1.90 (colored)

limit CGI process execution time to make REDoS attacks less effective;
attack surface pointed out by Sebastien Marie

Revision 1.94 / (download) - annotate - [select for diffs], Sun Aug 17 03:24:47 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.93: +4 -4 lines
Diff to previous 1.93 (colored) to selected 1.90 (colored)

Fully integrate apropos(1) into mandoc(1).
Switch the argmode on the progname, including man(1).
Provide -f and -k options to switch the argmode.
Store the argmode inside struct search, generalizing the flags.
Derive the deftype from the argmode when needed instead of storing it.
Store the outkey inside struct search instead of passing it alone.
While here, get rid of the trailing blanks in Makefile.depend.

Revision 1.93 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.92: +3 -3 lines
Diff to previous 1.92 (colored) to selected 1.90 (colored)

Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.

Revision 1.92 / (download) - annotate - [select for diffs], Tue Aug 5 15:29:30 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.91: +2 -1 lines
Diff to previous 1.91 (colored) to selected 1.90 (colored)

mansearch.h uses uint64_t, so it needs stdint.h; found on Linux

Revision 1.91 / (download) - annotate - [select for diffs], Fri Jul 25 21:05:41 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.90: +9 -35 lines
Diff to previous 1.90 (colored)

Choosing the right encoding is a tricky business...

Printing query strings for URIs *always* needs URI-encoding, and when
embedding the URI into an HTML document, it needs replacement of
the "&" separators by "&amp;" *in addition to that*, not instead.
Delete the function html_primtquery(), it was completely wrong.

You can see the badness by entering "mandoc &sec=2" into the query input
box before this patch and click "Submit".  You come to the right page at
first (...man.cgi?query=mandoc+%26sec%3D2&apropos=0&sec=0&...), but now
the link to mandoc(1) is wrong: ...mandoc.1?query=mandoc &amp;sec=2&amp;...
Clicking on that, the "&sec=2" disappears from the query input box and
suddenly you have the first dropdown set to "2 - System Calls".  Oops.

Revision 1.90 / (download) - annotate - [selected], Fri Jul 25 20:09:09 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +13 -8 lines
Diff to previous 1.89 (colored)

Sort the URI keys for .Xr links in the same order used by the search form,
and leave out the manpath when it is the default.
For building the HTML formatter options, do not use a static buffer.

Revision 1.89 / (download) - annotate - [select for diffs], Fri Jul 25 19:37:34 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +3 -2 lines
Diff to previous 1.88 (colored) to selected 1.90 (colored)

oops, we must not try to validate a manpath we don't have;
fixing an oversight introduced in rev. 1.77

Revision 1.88 / (download) - annotate - [select for diffs], Fri Jul 25 18:20:39 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +19 -17 lines
Diff to previous 1.87 (colored) to selected 1.90 (colored)

We cannot easily control the order of the QUERY_STRING keys generated
by the search form, it's just the order of the fields in the form.
Actually, that's not too bad; the generated URI resembles the
generating form.

To minimize confusion for people looking at URIs, give the keys
in the same order when generating URIs for search listings and
search redirections, the latter being used instead of search
listings that would have only one single entry.  Also, if the
manpath is the default, remove it form the generated URIs.

Revision 1.87 / (download) - annotate - [select for diffs], Fri Jul 25 17:52:04 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +3 -2 lines
Diff to previous 1.86 (colored) to selected 1.90 (colored)

In generated .Xr links, avoid double encoding of ampersands
and avoid empty arch= keys.

Revision 1.86 / (download) - annotate - [select for diffs], Fri Jul 25 17:34:06 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +12 -12 lines
Diff to previous 1.85 (colored) to selected 1.90 (colored)

Even though this is not XHTML yet, remove some gratuitious violations
of XHTML syntax.  Also add some cosmetic newlines to the HTML code.

Revision 1.85 / (download) - annotate - [select for diffs], Fri Jul 25 16:56:06 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.84: +17 -13 lines
Diff to previous 1.84 (colored) to selected 1.90 (colored)

The names of all other struct query memebers match the corresponding
QUERY_STRING keys, so rename "expr" to "query".
Also add some missing function prototypes.
No functional change.

Revision 1.84 / (download) - annotate - [select for diffs], Fri Jul 25 16:43:37 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +20 -15 lines
Diff to previous 1.83 (colored) to selected 1.90 (colored)

clean up pg_show() to not modify a string returned from getenv(3)

Revision 1.83 / (download) - annotate - [select for diffs], Fri Jul 25 16:07:13 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.82: +104 -49 lines
Diff to previous 1.82 (colored) to selected 1.90 (colored)

Rewrite http_parse() completely:
1. Make sure the last occurrence of each key is used, even if
it is empty, in which case it resets the value to the default.
2. When there is an HTTP encoding error, skip the affected
key-value pair only, but not all subsequent key-value pairs.
3. Do not modify a string returned from getenv(3).
4. Do not assume the NULL pointer is all null bits.

Revision 1.82 / (download) - annotate - [select for diffs], Thu Jul 24 20:30:45 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +1 -12 lines
Diff to previous 1.81 (colored) to selected 1.90 (colored)

Sort result pages first by section number, then by name.
By moving the sort from cgi.c to mansearch.c, we get two advantages:
Easier access to the data needed for sorting, in particular the section
number, and the apropos(1) command line utility profits as well.

Feature requested by deraadt@.

Revision 1.81 / (download) - annotate - [select for diffs], Thu Jul 24 08:26:57 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +26 -2 lines
Diff to previous 1.80 (colored) to selected 1.90 (colored)

Provide a dropdown entry "All Architectures" and make it the default.
Still, amd64 remains the default in the following sense:
If a man(1) mode search returns more than one page of the same name,
prefer amd64 over other architectures for immediate display.
ok deraadt@ daniel@

Revision 1.80 / (download) - annotate - [select for diffs], Tue Jul 22 18:14:13 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.79: +42 -2 lines
Diff to previous 1.79 (colored) to selected 1.90 (colored)

Security fix to prevent XSS attacks:
Restrict the character set of strings passed into html_alloc(),
in particular architecture names that come from the QUERY_STRING,
but also SCRIPT_NAME and manpath.conf content for additional safety,
and bail out safely on violations.
Issue reported by Sebastien Marie <semarie-openbsd at latrappe dot fr>.

Revision 1.79 / (download) - annotate - [select for diffs], Mon Jul 21 22:33:01 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +10 -6 lines
Diff to previous 1.78 (colored) to selected 1.90 (colored)

fix a minibug reported by kristaps@:
preserve manpath and arch in .Xr links

Revision 1.78 / (download) - annotate - [select for diffs], Mon Jul 21 15:45:17 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +3 -3 lines
Diff to previous 1.77 (colored) to selected 1.90 (colored)

Kristaps points out that the current HTTP/1.1 draft standard (RFC
2616) requires the Location: response-header field to be an absolute
URI (14.30), and only the most recent proposed standard (RFC 7231),
which is barely a month old, allows a relative Location: (7.1.2).
While most modern browsers appear to support relative Location:
headers, some may not, and it's maybe a bit early to rely on relative
Location: headers.

I'm not going back to the HTTP_HOST or SERVER_NAME CGI variables,
though.  While some CGI programs certainly require those, in which
case both the CGI programmer and the web server admin have to be
very careful to keep the system secure and reliable, man.cgi(8)
does not really need them.  We always know at compile time which
domain we are running for, and for man.cgi(8), security and reliability
are definitely much more important than flexibility.  So make HTTP_HOST
a compile-time definition for now.

Revision 1.77 / (download) - annotate - [select for diffs], Sat Jul 19 13:15:11 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +34 -5 lines
Diff to previous 1.76 (colored) to selected 1.90 (colored)

Security fix:
Validate the manpath up front and report a Bad Request if it is not
listed in manpath.conf, such that clients can't probe which directories
exist on the server.  In case of configuration errors, consistently
report Internal Server Error without disclosing any further information.

Partially based on a patch from Sebastien Marie <semarie-openbsd at
latrappe dot fr>, but avoiding a couple of issues with that patch
and approaching the issue in a somewhat more rigorous way.

Revision 1.76 / (download) - annotate - [select for diffs], Sat Jul 19 11:35:12 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +29 -2 lines
Diff to previous 1.75 (colored) to selected 1.90 (colored)

Security fix:
Validate the name of the file to show before opening it.
Only allow relative filenames starting with "man" or "cat"
and containing neither "/.." nor "../".

While here, correct the condition discarding an initial "./".

Vulnerability found by Sebastien Marie <semarie-openbsd at latrappe dot fr>.
Many thanks for sending a patch; however, i did not use it but made the
checks even stricter.

Revision 1.75 / (download) - annotate - [select for diffs], Fri Jul 18 19:03:39 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +3 -7 lines
Diff to previous 1.74 (colored) to selected 1.90 (colored)

Do not use the HTTP_HOST CGI variable,
just make the HTTP redirect Location: relative.
Less user input is good, it reduces the attack surface.
Besides, this removes one global variable and 4 lines of code.

Patch from Sebastien Marie <semarie-openbsd at latrappe dot fr>.

Revision 1.74 / (download) - annotate - [select for diffs], Fri Jul 18 14:46:25 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +13 -3 lines
Diff to previous 1.73 (colored) to selected 1.90 (colored)

When the MAN_DIR/manpath.conf configuration file does not exist or is empty,
log the problem, hand the pg_error_internal() error page to the client,
and exit(3) in a controlled way instead of stumbling on and segfaulting
later.

Patch from Sebastien Marie <semarie-openbsd at latrappe dot fr>,
messages tweaked by me.

Revision 1.73 / (download) - annotate - [select for diffs], Sun Jul 13 15:38:36 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.72: +16 -5 lines
Diff to previous 1.72 (colored) to selected 1.90 (colored)

Compatibility hack for the old "manpath=OpenBSD<blank>" query parameter format;
unfortunate, more than 400 links needing this are scattered all around
the www.openbsd.org website, and CVSweb needs this as well.

Revision 1.72 / (download) - annotate - [select for diffs], Sun Jul 13 12:55:45 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.71: +22 -23 lines
Diff to previous 1.71 (colored) to selected 1.90 (colored)

Make the calltree a bit easier to understand by giving the
functions that call resp_begin_html() names starting with "pg_"
and those called after resp_begin_html() names with "resp_".
No functional change, purely renaming functions.

Revision 1.71 / (download) - annotate - [select for diffs], Sun Jul 13 12:45:23 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +3 -1 lines
Diff to previous 1.70 (colored) to selected 1.90 (colored)

make source vs. formatted guessing a bit more robust

Revision 1.70 / (download) - annotate - [select for diffs], Sun Jul 13 12:31:23 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.69: +47 -21 lines
Diff to previous 1.69 (colored) to selected 1.90 (colored)

By popular demand, bring man.cgi default mode closer to what man(1) does:
Even when there are multiple pages with the same name in different
sections, show one of them, using the same priorities as in the
default man.conf(5) file.

Revision 1.69 / (download) - annotate - [select for diffs], Sun Jul 13 09:39:32 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +5 -5 lines
Diff to previous 1.68 (colored) to selected 1.90 (colored)

Install the manuals of the web interface below the same directory
as manpath.conf, such that we do not need to mix our own documentation
into the documentation we are serving, which may not even be possible
if the latter is updated automatically.

Based on an idea by beck@.

Revision 1.68 / (download) - annotate - [select for diffs], Sat Jul 12 23:46:44 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +97 -28 lines
Diff to previous 1.67 (colored) to selected 1.90 (colored)

Polish the search form using feedback from beck@ and others,
in particular introduce a section dropdown and an architecture dropdown.

Revision 1.67 / (download) - annotate - [select for diffs], Sat Jul 12 18:32:47 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +8 -18 lines
Diff to previous 1.66 (colored) to selected 1.90 (colored)

No need for run-time configuration, add minimal compile-time
configuration facilities, just two paths and two HTML strings.
Show the title on all pages, not just the index page.

Revision 1.66 / (download) - annotate - [select for diffs], Sat Jul 12 17:21:45 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +27 -100 lines
Diff to previous 1.65 (colored) to selected 1.90 (colored)

Simplify: Delete 74 lines of code including one enum type, one
global lookup table, two functions, two function arguments, one
struct member, one local variable, and the "search/" and "show/"
part of the URIs, all without losing functionality.

Revision 1.65 / (download) - annotate - [select for diffs], Sat Jul 12 16:14:35 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +35 -38 lines
Diff to previous 1.64 (colored) to selected 1.90 (colored)

Start fixing issues that beck@ helped find:

Distinguish between man(1) and apropos(1) mode by adding back the classical
QUERY_STRING variable "apropos=".  Change the default back to "apropos=0".
Control it by adding a HTML <SELECT> element for it.

Rename the "expr=" QUERY_STRING variable back to its classical name "query=",
i don't see how the new name is better than the classical one.

While here, drop the concept of a "legacy mode".  Simply continue to
support the features, and use what we consider best.

Revision 1.64 / (download) - annotate - [select for diffs], Sat Jul 12 01:55:30 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.63: +9 -8 lines
Diff to previous 1.63 (colored) to selected 1.90 (colored)

fix the two manual links on the index page

Revision 1.63 / (download) - annotate - [select for diffs], Fri Jul 11 22:27:35 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +9 -7 lines
Diff to previous 1.62 (colored) to selected 1.90 (colored)

merge OpenBSD rev. 1.3 by tedu@:
make http decode linear time.
also remove a redundant null check.

Revision 1.62 / (download) - annotate - [select for diffs], Fri Jul 11 22:25:44 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.61: +10 -9 lines
Diff to previous 1.61 (colored) to selected 1.90 (colored)

merge OpenBSD rev. 1.2 by tedu@:
http headers must end lines with CRLF.

Revision 1.61 / (download) - annotate - [select for diffs], Thu Jul 10 00:52:50 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +6 -3 lines
Diff to previous 1.60 (colored) to selected 1.90 (colored)

Link to the new man.cgi(8) manual, now that we have it!   :-)
While here, s/satisfy/match/ when talking about queries.

Revision 1.60 / (download) - annotate - [select for diffs], Wed Jul 9 17:03:07 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +11 -3 lines
Diff to previous 1.59 (colored) to selected 1.90 (colored)

some sugar for the index page

Revision 1.59 / (download) - annotate - [select for diffs], Wed Jul 9 16:23:01 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +51 -50 lines
Diff to previous 1.58 (colored) to selected 1.90 (colored)

Clean up error reporting:
* Consistent naming and use of resp_* functions.
* Split resp_noresult() out of resp_search() and reuse it.
* Log information about internal errors.
* And some minor fixes.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jul 9 14:18:59 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.57: +48 -45 lines
Diff to previous 1.57 (colored) to selected 1.90 (colored)

namespace cleanups:
CGI variable: s/CACHE_DIR/MAN_DIR/  because it's static, not a cache
default MAN_DIR: /cache/man.cgi/ -> /man/  see above
global variable: s/cache/mandir/  see above
global variable: s/css/cssdir/  for consistency with mandir
global variable: s/host/httphost/  for consistency with HTTP_HOST
global variable: s/progname/scriptname/  for consistency with SCRIPT_NAME
struct query: member s/manroot/manpath/  for consistency with QUERY_STRING

Revision 1.57 / (download) - annotate - [select for diffs], Wed Jul 9 12:09:04 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.56: +3 -10 lines
Diff to previous 1.56 (colored) to selected 1.90 (colored)

remove obsolete __sun includes
and improve some whitespace and comments

Revision 1.56 / (download) - annotate - [select for diffs], Wed Jul 9 11:34:46 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.55: +3 -2 lines
Diff to previous 1.55 (colored) to selected 1.90 (colored)

set a reasonable default for .Os

Revision 1.55 / (download) - annotate - [select for diffs], Wed Jul 9 09:27:01 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.54: +3 -1 lines
Diff to previous 1.54 (colored) to selected 1.90 (colored)

oops, forgot to trim the newline character

Revision 1.54 / (download) - annotate - [select for diffs], Wed Jul 9 09:19:03 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.53: +14 -28 lines
Diff to previous 1.53 (colored) to selected 1.90 (colored)

Simplify pathgen() even more.
Let manpath.conf be a plain text list of the directories to use.
As a bonus, this makes the order configurable.
Get rid of <dirent.h>, opendir(3), readdir(3), stat(2).

Revision 1.53 / (download) - annotate - [select for diffs], Wed Jul 9 08:53:28 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.52: +33 -13 lines
Diff to previous 1.52 (colored) to selected 1.90 (colored)

include manpath= when printing queries, and omit empty parameters

Revision 1.52 / (download) - annotate - [select for diffs], Wed Jul 9 07:30:47 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.51: +85 -377 lines
Diff to previous 1.51 (colored) to selected 1.90 (colored)

Switch over man.cgi to SQLite.  While here:
* Simplify pathgen(), just use the subdirs of the cache dir.
* Simplify URI paths, just use show/<manpath>/<filename>.
* Drop struct paths, just use plain strings.
* Garbage collect unused headers.

Revision 1.51 / (download) - annotate - [select for diffs], Wed Apr 23 21:40:47 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Branch point for: VERSION_1_12
Changes since 1.50: +4 -5 lines
Diff to previous 1.50 (colored) to selected 1.90 (colored)

Audit malloc(3)/calloc(3)/realloc(3) usage.
First committed to wrong branch, sorry.

Revision 1.50 / (download) - annotate - [select for diffs], Sun Mar 23 12:19:03 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.49: +2 -1 lines
Diff to previous 1.49 (colored) to selected 1.90 (colored)

needs mandoc_aux, too

Revision 1.49 / (download) - annotate - [select for diffs], Wed Mar 19 22:20:43 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (colored) to selected 1.90 (colored)

Without the MPARSE_SO option, if the file contains nothing but a
single .so request, do not read the file pointed to, but instead
let mparse_result() provide the file name pointed to as a return
value.  To be used by makewhatis(8) in the future.

Revision 1.48 / (download) - annotate - [select for diffs], Wed Mar 19 22:05:10 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored) to selected 1.90 (colored)

cope with mparse_alloc() interface change

Revision 1.47 / (download) - annotate - [select for diffs], Sun Jan 5 20:41:04 2014 UTC (10 years, 2 months ago) by schwarze
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored) to selected 1.90 (colored)

Cope with mparse_alloc() interface change.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Oct 11 00:06:48 2013 UTC (10 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3
Changes since 1.45: +36 -5 lines
Diff to previous 1.45 (colored) to selected 1.90 (colored)

Thomas Klausner <wiz at NetBSD dot org> finally succeeded to build
on SmartOS and sent these additional patches, thanks!

Revision 1.45 / (download) - annotate - [select for diffs], Wed Jun 5 02:00:26 2013 UTC (10 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_2
Changes since 1.44: +17 -18 lines
Diff to previous 1.44 (colored) to selected 1.90 (colored)

Some places used PATH_MAX from <limits.h>, some MAXPATHLEN from <sys/param.h>.
Consistently use the PATH_MAX since it is specified by POSIX,
while MAXPATHLEN is not.
In preparation for using this at a few more places.

Revision 1.44 / (download) - annotate - [select for diffs], Sun May 27 17:48:57 2012 UTC (11 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored) to selected 1.90 (colored)

Support -Ios='OpenBSD 5.1' to override uname(3) as the source of the
default value for the mdoc(7) .Os macro.
Needed for man.cgi on the OpenBSD website.

Problem with man.cgi first noticed by deraadt@;
beck@ and deraadt@ agree with the way to solve the issue.

"Please check them in and I'll look into them later!" kristaps@

Revision 1.43 / (download) - annotate - [select for diffs], Sun Mar 25 00:46:39 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored) to selected 1.90 (colored)

Fix lookup not to use full-out regexp search.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Mar 24 01:46:25 2012 UTC (12 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_1
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored) to selected 1.90 (colored)

Be insane.  Make apropos(1) subsume man(1).

Revision 1.41 / (download) - annotate - [select for diffs], Sat Mar 24 00:31:55 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Changes since 1.40: +25 -12 lines
Diff to previous 1.40 (colored) to selected 1.90 (colored)

Simplify by not pre-filtering the result vector for satisfied matches:
we can do this in the frontend.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Mar 23 09:03:07 2012 UTC (12 years ago) by kristaps
Branch: MAIN
Changes since 1.39: +9 -29 lines
Diff to previous 1.39 (colored) to selected 1.90 (colored)

Knock out useless & confusing whatis mode.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Dec 25 17:49:52 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.38: +4 -2 lines
Diff to previous 1.38 (colored) to selected 1.90 (colored)

Continue changing mandoc.{index,db} into whatis.{index,db}.  Use mandocdb.h
to do so.

Revision 1.38 / (download) - annotate - [select for diffs], Fri Dec 16 20:06:58 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored) to selected 1.90 (colored)

Two lint fixes.

Revision 1.37 / (download) - annotate - [select for diffs], Fri Dec 16 20:05:31 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.36: +4 -2 lines
Diff to previous 1.36 (colored) to selected 1.90 (colored)

Fix assertion found when plugging legacy man.cgi query string into my
man.cgi.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Dec 16 18:37:12 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.35: +72 -38 lines
Diff to previous 1.35 (colored) to selected 1.90 (colored)

When routing to a "result" page in the cgi, remember our input parameters
and repeat them in the search bar.  This is handy.  While here, make the
QUERY_STRING parser a bit simpler.

Revision 1.35 / (download) - annotate - [select for diffs], Fri Dec 16 12:06:35 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.34: +11 -11 lines
Diff to previous 1.34 (colored) to selected 1.90 (colored)

Make the stored "cat"/"mdoc"/"man" strings just be c/d/a single-character
bytes.  This cuts down a little in index size and allows for cleaner
extraction of information.

Revision 1.34 / (download) - annotate - [select for diffs], Fri Dec 16 08:04:34 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.33: +9 -4 lines
Diff to previous 1.33 (colored) to selected 1.90 (colored)

Make paths in the mandocdb(8) index relative to the databases' path
prefix.  This means that an index in, say, /usr/share/man will point to
man1/foo.1 instead of /usr/share/man/man1/foo.1.  Not only does this
save a lot of space, it also allows manual trees to be moved around
without any side effects to the mandocdb(8) databases.

Revision 1.33 / (download) - annotate - [select for diffs], Thu Dec 15 12:18:57 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.32: +7 -4 lines
Diff to previous 1.32 (colored) to selected 1.90 (colored)

Further tweaks for output consistency.

Revision 1.32 / (download) - annotate - [select for diffs], Thu Dec 15 12:05:19 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.31: +36 -34 lines
Diff to previous 1.31 (colored) to selected 1.90 (colored)

Some presentation polish in man.cgi:

 - include search bar above result page (I relent: it's annoying to
   follow three links then press back three times to get a search page);
 - make man.cgi.css into man-cgi.css so Apache isn't confused by two
   handlers (css, cgi);
 - finally consolidate example.style.css to be under the div.mandoc css
   selector;
 - put catman pages under div.catman;
 - put search bar under div#mancgi;
 - reflect this properly in the bundled CSS files.

Revision 1.31 / (download) - annotate - [select for diffs], Wed Dec 14 13:36:59 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored) to selected 1.90 (colored)

Unbreak man.cgi's css directories when CSS_DIR isn't specified.

Revision 1.30 / (download) - annotate - [select for diffs], Mon Dec 12 02:00:49 2011 UTC (12 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored) to selected 1.90 (colored)

implement -C (alternative config file) for apropos(1) and mandocdb(8),
including various tweaks to the whatis(8) manual;
ok kristaps@

Revision 1.29 / (download) - annotate - [select for diffs], Sun Dec 11 00:22:47 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.28: +54 -57 lines
Diff to previous 1.28 (colored) to selected 1.90 (colored)

When 303'ing a search directly to a page, remember to specify its manroot.
Also allow for a CSS_DIR to specify alternate CSS locations.
Finally, some clutter as I assume that "css" and "progname" are already
HTML-safe.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Dec 10 23:09:25 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored) to selected 1.90 (colored)

Slip in a fix to allow for empty cache directories.

Revision 1.27 / (download) - annotate - [select for diffs], Sat Dec 10 23:04:31 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.26: +24 -5 lines
Diff to previous 1.26 (colored) to selected 1.90 (colored)

Finishing touches on multi-manroot man.cgi.  If more than one root is
specified, write them out using a SELECT box.  Else write nothing (the
manroot will still be checked if it's specified).

Revision 1.26 / (download) - annotate - [select for diffs], Sat Dec 10 22:45:47 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.25: +46 -29 lines
Diff to previous 1.25 (colored) to selected 1.90 (colored)

Switch on "manpath=" handling, which I call the "manroot" (as "manpath" is
reserved for paths within a manroot).  This functionality is bare-bones:
right now, the default manroot is the first one scanned from the cache
directory.  At some point this will be sexy and smooth, but it's easy to
upgrade functionality by modifying pathgen() and so forth.  If a manroot
isn't parsed from the "manpath=", results are always empty.

Revision 1.25 / (download) - annotate - [select for diffs], Sat Dec 10 22:20:59 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +27 -14 lines
Diff to previous 1.24 (colored) to selected 1.90 (colored)

Encode "manroot" into file URL and parse it properly.  Right now this
just uses the first manroot by default.

Revision 1.24 / (download) - annotate - [select for diffs], Sat Dec 10 21:51:07 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +284 -163 lines
Diff to previous 1.23 (colored) to selected 1.90 (colored)

Big upgrade and polish for cgi.c.

- Deprecate kvals (key/value pairs for QUERY_STRING values).  Since there's
only one place that uses this, kval_parse (now http_parse()) dumps directly
into struct query, which is more high-level.

- Put query values directly into struct req.

- The biggest difference is dynamic support for multiple "manroots".  A
"manroot" is a path with an "etc/catman.conf" file.  When the cgi starts,
it (prefix) recurses through its CACHE_DIR searching for "etc" directories.
When one's found, it sees if a catman.conf file exists.  This is marked
as a manroot and appended to a list.  The name of a manroot is the path
without slashes (e.g., OpenBSD/4.9 -> "OpenBSD 4.9").

Right now "manroot" isn't enabled.  The first manroot is chosen as the
real one.  I'll add the interface to it in the next checkins, but it'll be
quite simple.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Dec 10 10:59:21 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +12 -5 lines
Diff to previous 1.22 (colored) to selected 1.90 (colored)

FreeBSD's man.cgi uses a "default" value for no arch.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Dec 10 00:06:34 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored) to selected 1.90 (colored)

Add some periods (just to see if mlmmj is working again...).

Revision 1.21 / (download) - annotate - [select for diffs], Fri Dec 9 23:18:51 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +5 -3 lines
Diff to previous 1.20 (colored) to selected 1.90 (colored)

Forgot to make whatis the default during abstraction.  Do it again.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Dec 9 11:29:19 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +153 -137 lines
Diff to previous 1.19 (colored) to selected 1.90 (colored)

Abstract query extraction code.  Perform some readability fixes while here.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Dec 8 22:47:09 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +42 -4 lines
Diff to previous 1.18 (colored) to selected 1.90 (colored)

If no man.cgi `whatis' results are found, offer a quick link to the apropos
query mode.

Revision 1.18 / (download) - annotate - [select for diffs], Thu Dec 8 18:39:14 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored) to selected 1.90 (colored)

Fix stupid typo: strlcpy() instead of strlcat().

Revision 1.17 / (download) - annotate - [select for diffs], Thu Dec 8 00:48:28 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored) to selected 1.90 (colored)

Look for man.cgi files in the cache, not under the volume path.

Revision 1.16 / (download) - annotate - [select for diffs], Wed Dec 7 16:18:52 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +4 -1 lines
Diff to previous 1.15 (colored) to selected 1.90 (colored)

Tweak to make man.cgi's search results validate properly.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Dec 7 16:08:55 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +15 -5 lines
Diff to previous 1.14 (colored) to selected 1.90 (colored)

Apropos and man.cgi should strcasecmp their output sorting.
man.cgi should sort in the first place -- it wasn't before.
Revert uppercasing of man.cgi title.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Dec 7 15:55:06 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +28 -21 lines
Diff to previous 1.13 (colored) to selected 1.90 (colored)

Add skeleton man.cgi.css file.  I don't think this should become more
complicated than this.  Also make the title be printed out in caps as it
is in apropos(1) and whatis(1).

Revision 1.13 / (download) - annotate - [select for diffs], Wed Dec 7 15:12:34 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +18 -1 lines
Diff to previous 1.12 (colored) to selected 1.90 (colored)

Accept old-school man.cgi parameters like "sektion" and "query".  This still
needs work because specifying an arch with "arch=i386" will return results
that don't have an arch specified.  I think this is weird, but it will need
to be supported if we want backwards compatibility.

Revision 1.12 / (download) - annotate - [select for diffs], Wed Dec 7 13:00:40 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.11: +56 -42 lines
Diff to previous 1.11 (colored) to selected 1.90 (colored)

Have a whatis/apropos mode, with the default (hitting enter within the
expression text) be whatis.  This is a much nicer default than apropos,
which can be scary.  While here, fix the cat.css location (erroneously
put in the response page instead of the catman page) and add bits for
a default style-sheet.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Dec 7 11:52:36 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +18 -4 lines
Diff to previous 1.10 (colored) to selected 1.90 (colored)

By default, man.cgi should compile with -static (this was unset by mistake).
Also, set a custom CSS for man.cgi catman files.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Dec 7 00:23:04 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.9: +184 -57 lines
Diff to previous 1.9 (colored) to selected 1.90 (colored)

Add cat2html functionality.  This keeps track of italic/bold mode per line
and properly handles some funny troff-isms we've exposed.  I originally
wanted to use man2html.c (found on W3's website with no known author)
but the code is dodgy.  This will need some more work (links, etc.) but
does a decent job thusfar.

Note: I think it's better style NOT to use <pre>, and instead have each
line employ <BR> afterward.  This allows browsers to break the lines if
necessary.  This can be changed trivially (replacing the newline and pre
tags with the <BR> and new tag).

Revision 1.9 / (download) - annotate - [select for diffs], Sun Dec 4 22:52:50 2011 UTC (12 years, 3 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +62 -17 lines
Diff to previous 1.8 (colored) to selected 1.90 (colored)

Make catman and man.cgi understand the index type-field.
Also make catman's man.conf be generated as catman.conf to avoid clobbering
a real man.conf file.
Finally, add a placeholder catman() function to man.cgi for preformatted
manuals in the cache.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Nov 27 11:46:44 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +37 -59 lines
Diff to previous 1.7 (colored) to selected 1.90 (colored)

Removing INSECURE mode.  This is a work in progress!  Logic for
formatting manpages is now linked into man.cgi.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Nov 24 12:27:18 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +91 -28 lines
Diff to previous 1.6 (colored) to selected 1.90 (colored)

Let man.cgi run in two modes:

 (1) Insecure.  This means that we're operating over the full file-system
     with access to mandoc(1).  In this mode, mandocdb entries are formatted
     on-the-fly.  The $INSECURE environment variable must be passed to
     man.cgi for this mode to work.

 (2) Secure.  Manuals are assumed to be pre-formatted in a cache directory,
     which may be set with $CACHE_DIR but default to /cache/man.cgi.
     This mode works with manup(8), which updates the cached pages from
     outside of the jail.  man.cgi simply locates the manual file and
     outputs it to stdout.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Nov 23 10:01:04 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +422 -81 lines
Diff to previous 1.5 (colored) to selected 1.90 (colored)

man.cgi works for the non-jailed case.
In other words, if you smash this into a cgi-bin directory, it will Just
Work for your system's manuals (it of course needs access to mandoc(1) and
your file-system, hence "non-jailed").
The notion of a jailed case is much more subtle and being worked on now.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Nov 20 12:39:08 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +2 -1 lines
Diff to previous 1.4 (colored) to selected 1.90 (colored)

Merge schwarze@'s work for 64-bit types.  This is based on a tweaked patch
submitted to tech@ on 16/11/2011, 01:39.  It has been updated to account
for the logical-operator functions and to avoid keeping a live pointer into
the DBT value, which is not guaranteed to be consistent across calls into
the bdb library.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Nov 13 10:49:57 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.3: +3 -2 lines
Diff to previous 1.3 (colored) to selected 1.90 (colored)

Inventing new keywords for mostly the same thing when a well-established
set of keywords already exists is a bad idea, so reuse the mdoc(7)
macro names as apropos(1) search types.  This is a gain in brevity
as well.  Some time ago, kristaps@ agreed in principle.

The search type bit field constants are used by both mandocdb(8) and
apropos(1) and should better stay in sync, so give them their own
header file.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Nov 13 10:12:05 2011 UTC (12 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored) to selected 1.90 (colored)

Less misleading file names; ok kristaps@.

Revision 1.2 / (download) - annotate - [select for diffs], Wed Nov 9 22:05:56 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +11 -3 lines
Diff to previous 1.1 (colored) to selected 1.90 (colored)

Make apropos's lookup use a find(1)-like expression.  I'll write more on
this when it completes; this is to keep it in-tree.

Right now this uses prefix notation.  Ignore it.  I'll make this into
infix notation real soon.

The goal of this (exprcomp and exprexec) is to have arbitrary logical
expressions.

Revision 1.1 / (download) - annotate - [select for diffs], Wed Nov 9 01:24:23 2011 UTC (12 years, 4 months ago) by kristaps
Branch: MAIN
Diff to selected 1.90 (colored)

Split apropos.c into db.c and apropos.h with simpler code (re-written, but
inspired by apropos.c and mandoc-tools' mandoc-cgi.c).  This uses UTF-8
right now for its re-writing, but will soon accomodate for the regular
suspects (this is a rather simple matter).

I also introduce man.cgi (cgi.c), which is a standalone CGI that replaces
mandoc-tools' mandoc.cgi.  Right now it's just a framework.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb