]> git.cameronkatri.com Git - mandoc.git/log
mandoc.git
13 years agoSome presentation polish in man.cgi:
Kristaps Dzonsons [Thu, 15 Dec 2011 12:05:19 +0000 (12:05 +0000)]
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.

13 years agoNote that archives are being hosted at gmane.
Kristaps Dzonsons [Wed, 14 Dec 2011 23:17:12 +0000 (23:17 +0000)]
Note that archives are being hosted at gmane.

13 years agoUnbreak man.cgi's css directories when CSS_DIR isn't specified.
Kristaps Dzonsons [Wed, 14 Dec 2011 13:36:59 +0000 (13:36 +0000)]
Unbreak man.cgi's css directories when CSS_DIR isn't specified.

13 years agoRemove stray warnx() left in the manpath.c code.
Kristaps Dzonsons [Tue, 13 Dec 2011 21:09:01 +0000 (21:09 +0000)]
Remove stray warnx() left in the manpath.c code.

13 years agoHave manpath.c properly use manpath(1), that is, using -C and -m and so on.
Kristaps Dzonsons [Tue, 13 Dec 2011 20:56:46 +0000 (20:56 +0000)]
Have manpath.c properly use manpath(1), that is, using -C and -m and so on.
This also cleans up the code a little bit.  While here, make some functions
static that are only used within manpath.c.

13 years agoCompatibility support fgetln() on Linux. This uses the BSD-licensed
Kristaps Dzonsons [Tue, 13 Dec 2011 11:26:12 +0000 (11:26 +0000)]
Compatibility support fgetln() on Linux.  This uses the BSD-licensed
implementation from NetBSD tnftpd, Christos Zoulas (copyright message
retained in the compat_fgetln.c file).  Patch verified by schwarze@.  He
notes that you'll need -pthread for -static binaries (due to libdb), so
I've noted that -static should really only be used for BSD UNIX.

While here, add some forgotten goop to the Makefile, building and
cleaning extra manpages.

13 years agoimplement -C (alternative config file) for apropos(1) and mandocdb(8),
Ingo Schwarze [Mon, 12 Dec 2011 02:00:49 +0000 (02:00 +0000)]
implement -C (alternative config file) for apropos(1) and mandocdb(8),
including various tweaks to the whatis(8) manual;
ok kristaps@

13 years agoExplain where .so paths are rooted, and why, and discourage its use;
Ingo Schwarze [Sun, 11 Dec 2011 00:38:11 +0000 (00:38 +0000)]
Explain where .so paths are rooted, and why, and discourage its use;
feedback and ok jmc@, suggested by and ok kristaps@.

13 years agoUgh, environmental variables are Ev, not Er. Fix typos.
Kristaps Dzonsons [Sun, 11 Dec 2011 00:24:41 +0000 (00:24 +0000)]
Ugh, environmental variables are Ev, not Er.  Fix typos.

13 years agoNote CSS_DIR in man.cgi.7.
Kristaps Dzonsons [Sun, 11 Dec 2011 00:23:55 +0000 (00:23 +0000)]
Note CSS_DIR in man.cgi.7.

13 years agoWhen 303'ing a search directly to a page, remember to specify its manroot.
Kristaps Dzonsons [Sun, 11 Dec 2011 00:22:47 +0000 (00:22 +0000)]
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.

13 years agoBegin working on release notes. Also whitespace-fix man.cgi.7.
Kristaps Dzonsons [Sat, 10 Dec 2011 23:44:42 +0000 (23:44 +0000)]
Begin working on release notes.  Also whitespace-fix man.cgi.7.

13 years agoUpdate man.cgi.7 to note compatibility and running with multiple roots.
Kristaps Dzonsons [Sat, 10 Dec 2011 23:31:06 +0000 (23:31 +0000)]
Update man.cgi.7 to note compatibility and running with multiple roots.

13 years agoSlip in a fix to allow for empty cache directories.
Kristaps Dzonsons [Sat, 10 Dec 2011 23:09:25 +0000 (23:09 +0000)]
Slip in a fix to allow for empty cache directories.

13 years agoFinishing touches on multi-manroot man.cgi. If more than one root is
Kristaps Dzonsons [Sat, 10 Dec 2011 23:04:31 +0000 (23:04 +0000)]
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).

13 years agoSwitch on "manpath=" handling, which I call the "manroot" (as "manpath" is
Kristaps Dzonsons [Sat, 10 Dec 2011 22:45:47 +0000 (22:45 +0000)]
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.

13 years agoEncode "manroot" into file URL and parse it properly. Right now this
Kristaps Dzonsons [Sat, 10 Dec 2011 22:20:59 +0000 (22:20 +0000)]
Encode "manroot" into file URL and parse it properly.  Right now this
just uses the first manroot by default.

13 years agoAvoid leaking index records:
Ingo Schwarze [Sat, 10 Dec 2011 22:01:06 +0000 (22:01 +0000)]
Avoid leaking index records:
Before allocating a record for a file,
first make sure we actually want to use the file.

13 years agoBig upgrade and polish for cgi.c.
Kristaps Dzonsons [Sat, 10 Dec 2011 21:51:07 +0000 (21:51 +0000)]
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.

13 years agoPlug a memory leak in single_search().
Kristaps Dzonsons [Sat, 10 Dec 2011 21:46:59 +0000 (21:46 +0000)]
Plug a memory leak in single_search().

13 years agoFix selection of arch-specific manuals:
Ingo Schwarze [Sat, 10 Dec 2011 16:53:39 +0000 (16:53 +0000)]
Fix selection of arch-specific manuals:
(1) Correctly compare cat vs. man paths.
(2) Compare arch (and section) names case-insensitively.
Problem noticed by kristaps@.

13 years agoAdding some missing "install" bits to Makefile.
Kristaps Dzonsons [Sat, 10 Dec 2011 11:00:00 +0000 (11:00 +0000)]
Adding some missing "install" bits to Makefile.

13 years agoFreeBSD's man.cgi uses a "default" value for no arch.
Kristaps Dzonsons [Sat, 10 Dec 2011 10:59:21 +0000 (10:59 +0000)]
FreeBSD's man.cgi uses a "default" value for no arch.

13 years agoAdd some periods (just to see if mlmmj is working again...).
Kristaps Dzonsons [Sat, 10 Dec 2011 00:06:34 +0000 (00:06 +0000)]
Add some periods (just to see if mlmmj is working again...).

13 years agoForgot to make whatis the default during abstraction. Do it again.
Kristaps Dzonsons [Fri, 9 Dec 2011 23:18:51 +0000 (23:18 +0000)]
Forgot to make whatis the default during abstraction.  Do it again.

13 years agoAbstract query extraction code. Perform some readability fixes while here.
Kristaps Dzonsons [Fri, 9 Dec 2011 11:29:19 +0000 (11:29 +0000)]
Abstract query extraction code.  Perform some readability fixes while here.

13 years agoWhen specifying an architecture to whatis(1)/apropos(1)/man.cgi(7), do a
Kristaps Dzonsons [Fri, 9 Dec 2011 11:18:57 +0000 (11:18 +0000)]
When specifying an architecture to whatis(1)/apropos(1)/man.cgi(7), do a
comparison only if the manual specifies an architecture, otherwise let it
through.  Looked over by schwarze@.  This brings us much more in line with
OpenBSD's behaviour.

13 years agoTweak pformatted():
Ingo Schwarze [Fri, 9 Dec 2011 11:16:34 +0000 (11:16 +0000)]
Tweak pformatted():
* If the first section is empty, use the file name as .Nd.
* No need to check (len > 0) after successful fgetln(3).
* Improve some comments and strip trailing whitespace.
ok kristaps@

13 years agoConsiderably tidy mandocdb(8) catman descriptions by skipping to the first
Kristaps Dzonsons [Fri, 9 Dec 2011 01:21:10 +0000 (01:21 +0000)]
Considerably tidy mandocdb(8) catman descriptions by skipping to the first
hyphen-space combo, not the last hyphen as done previously.

13 years agoStrip backspace encoding from preformatted manuals. This cleans up a lot
Kristaps Dzonsons [Fri, 9 Dec 2011 00:49:01 +0000 (00:49 +0000)]
Strip backspace encoding from preformatted manuals.  This cleans up a lot
of catpage entries in the mandoc databases.

13 years agoIf no man.cgi `whatis' results are found, offer a quick link to the apropos
Kristaps Dzonsons [Thu, 8 Dec 2011 22:47:09 +0000 (22:47 +0000)]
If no man.cgi `whatis' results are found, offer a quick link to the apropos
query mode.

13 years agoFix stupid typo: strlcpy() instead of strlcat().
Kristaps Dzonsons [Thu, 8 Dec 2011 18:39:14 +0000 (18:39 +0000)]
Fix stupid typo: strlcpy() instead of strlcat().

13 years agoClean up grok of preformatted manual description.
Kristaps Dzonsons [Thu, 8 Dec 2011 09:19:13 +0000 (09:19 +0000)]
Clean up grok of preformatted manual description.
 (1) put fclose() at the end, as line isn't valid afterward (see fgetln())
 (2) clean up loops to be more readable to my old eyes
 (3) mandate trailing newline, nul-terminate, and use strrchr

13 years agoindex_prune always counted the free slots,
Ingo Schwarze [Thu, 8 Dec 2011 02:24:31 +0000 (02:24 +0000)]
index_prune always counted the free slots,
but didn't tell anybody about them, so they weren't reused

13 years agoIf arguments are passed to mandocdb(8) in "default" mode, then use
Kristaps Dzonsons [Thu, 8 Dec 2011 01:00:58 +0000 (01:00 +0000)]
If arguments are passed to mandocdb(8) in "default" mode, then use
realpath() to convert them into absolute paths before putting the
traversed subdirectory filenames into the index.

13 years agoLook for man.cgi files in the cache, not under the volume path.
Kristaps Dzonsons [Thu, 8 Dec 2011 00:48:28 +0000 (00:48 +0000)]
Look for man.cgi files in the cache, not under the volume path.

13 years agoFirst, remove the catman(8) jobstart() stuff. It only copies files.
Kristaps Dzonsons [Thu, 8 Dec 2011 00:20:52 +0000 (00:20 +0000)]
First, remove the catman(8) jobstart() stuff.  It only copies files.
Second, when creating the destination filename, append the index's file
(which is an absolute path) to the cache directory, not to the index's
directory name.

13 years agoTweak to make man.cgi's search results validate properly.
Kristaps Dzonsons [Wed, 7 Dec 2011 16:18:52 +0000 (16:18 +0000)]
Tweak to make man.cgi's search results validate properly.

13 years agoApropos and man.cgi should strcasecmp their output sorting.
Kristaps Dzonsons [Wed, 7 Dec 2011 16:08:55 +0000 (16:08 +0000)]
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.

13 years agoAdd skeleton man.cgi.css file. I don't think this should become more
Kristaps Dzonsons [Wed, 7 Dec 2011 15:55:06 +0000 (15:55 +0000)]
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).

13 years agoAccept old-school man.cgi parameters like "sektion" and "query". This still
Kristaps Dzonsons [Wed, 7 Dec 2011 15:12:34 +0000 (15:12 +0000)]
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.

13 years agoHave a whatis/apropos mode, with the default (hitting enter within the
Kristaps Dzonsons [Wed, 7 Dec 2011 13:00:40 +0000 (13:00 +0000)]
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.

13 years agoMake installing CGI a bit easier.
Kristaps Dzonsons [Wed, 7 Dec 2011 11:59:32 +0000 (11:59 +0000)]
Make installing CGI a bit easier.

13 years agoBy default, man.cgi should compile with -static (this was unset by mistake).
Kristaps Dzonsons [Wed, 7 Dec 2011 11:52:36 +0000 (11:52 +0000)]
By default, man.cgi should compile with -static (this was unset by mistake).
Also, set a custom CSS for man.cgi catman files.

13 years agoImplement search support for 24 additional macros, extract more information
Ingo Schwarze [Wed, 7 Dec 2011 01:57:20 +0000 (01:57 +0000)]
Implement search support for 24 additional macros, extract more information
from Fn, and lift section restrictions from An Cd Er Ev Fn Fo In Pa St Va Vt
by removing 4 handler functions and 50 lines of code.
ok kristaps@

13 years agoAdd cat2html functionality. This keeps track of italic/bold mode per line
Kristaps Dzonsons [Wed, 7 Dec 2011 00:23:04 +0000 (00:23 +0000)]
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).

13 years agomust ignore \h with quoted argument
Ingo Schwarze [Mon, 5 Dec 2011 00:41:40 +0000 (00:41 +0000)]
must ignore \h with quoted argument

13 years agoImplement mdoc(7)-like output style variant for man(7) documents:
Ingo Schwarze [Sun, 4 Dec 2011 23:10:52 +0000 (23:10 +0000)]
Implement mdoc(7)-like output style variant for man(7) documents:
* one instead of three blank lines after the page header;
* one instead of three blank lines before the page footer;
* source instead of title(section) in the lower right corner.
Select this style variant with the undocumented command line option -Omdoc.
In the long run, we hope to unify the ouput of both languages and
to pull this out again, but that requires coordination with groff.

Grudgingly ok and, (as usual,-) more comments requested by  kristaps@

13 years agoMake catman and man.cgi understand the index type-field.
Kristaps Dzonsons [Sun, 4 Dec 2011 22:52:50 +0000 (22:52 +0000)]
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.

13 years agoFix parsing of file names given on the command line; i broke it
Ingo Schwarze [Sun, 4 Dec 2011 14:23:29 +0000 (14:23 +0000)]
Fix parsing of file names given on the command line; i broke it
when adding support for formatted manual pages.

13 years agoJumping out of man_unscope() for the root node is a bad idea
Ingo Schwarze [Sun, 4 Dec 2011 00:44:12 +0000 (00:44 +0000)]
Jumping out of man_unscope() for the root node is a bad idea
because that will skip root node validation, potentially entering
rendering modules will NULL pointers lurking in the meta data.
Instead, always validate the root node and (as suggested by joerg@)
assert validity of the meta data before using it in the renderers.
ok joerg@

13 years agoRemove an OpenBSD-specific tweak regarding .Xr spacing and make it
Ingo Schwarze [Sat, 3 Dec 2011 23:59:14 +0000 (23:59 +0000)]
Remove an OpenBSD-specific tweak regarding .Xr spacing and make it
compatible with groff-1.21.  This tweak was originally added for
compatibility with groff-1.15, which is no longer needed.

ok jmc@ kristaps@

13 years agoBack out lorder, which doesn't seem necessary (?). I think this means all
Kristaps Dzonsons [Sat, 3 Dec 2011 18:47:09 +0000 (18:47 +0000)]
Back out lorder, which doesn't seem necessary (?).  I think this means all
fields are endian-neutral, although the recno(3) key is unknown.

13 years agoWhen processing .Sh HEAD, as soon as we know which section this is,
Ingo Schwarze [Sat, 3 Dec 2011 16:58:54 +0000 (16:58 +0000)]
When processing .Sh HEAD, as soon as we know which section this is,
fix up the section attributes of the HEAD, it's parent BLOCK, and
all its (text) children.  This is required because the section
attributes get set when each node is allocated, i.e. before processing
the content of the node itself.  Thus, the listed nodes got the section
attribute of the preceding section.  No need to fix up the BODY, all
is fine there already.
Found while implementing TYPE_Sh for mandocdb(8).
OK and comment requested by kristaps@.

13 years agoISO style "%Y-%m-%d" dates are common in man(7) .TH.
Ingo Schwarze [Sat, 3 Dec 2011 16:08:51 +0000 (16:08 +0000)]
ISO style "%Y-%m-%d" dates are common in man(7) .TH.
They have been considered valid in the past, but were reformatted
to the mdoc(7) "Month day, year" style.
To make page footers more similar to groff, no longer reformat them,
just print them as they are.
This doesn't change anything with respect to what's considered valid
or what is warned about.

ok kristaps@

13 years agoMake sure the btree(3) goop is also BE. This covers both the DB metadata
Kristaps Dzonsons [Sat, 3 Dec 2011 12:09:07 +0000 (12:09 +0000)]
Make sure the btree(3) goop is also BE.  This covers both the DB metadata
and prior commits handle the contained binary fields.

13 years agoIn man(7), when no explicit volume name is given, use the default
Ingo Schwarze [Fri, 2 Dec 2011 01:37:14 +0000 (01:37 +0000)]
In man(7), when no explicit volume name is given, use the default
volume name for the respective manual section, just like in mdoc(7).
This gives us nicer page headers for cvs(1), lynx(1), tic(1),
mkhybrid(8), and many curses(3) manuals.

ok kristaps@

To not break compatibility, i wrote a corresponding patch for GNU troff
which Werner Lemberg accepted upstream at rev. 1.65 of:
http://cvs.savannah.gnu.org/viewvc/groff/tmac/an-old.tmac?root=groff

13 years agoThis is a little gross: Linux and Apple need lots some cajoling to work
Kristaps Dzonsons [Fri, 2 Dec 2011 00:21:56 +0000 (00:21 +0000)]
This is a little gross: Linux and Apple need lots some cajoling to work
with byte-swapping.  Tested on Mac.  Any Linux machines somebody can
test on?  Anybody?

While here, note the correct byte-size in mandocdb(8) and also note
field widths and endianness.  The btree is now endian-neutral.

13 years agoUse OpenBSD's endian functions. Make btree type also be endian-neutral.
Kristaps Dzonsons [Thu, 1 Dec 2011 23:55:58 +0000 (23:55 +0000)]
Use OpenBSD's endian functions.  Make btree type also be endian-neutral.

13 years agoIn apropos_db.c, move all btree reading (and safety checks) into the
Kristaps Dzonsons [Thu, 1 Dec 2011 23:46:26 +0000 (23:46 +0000)]
In apropos_db.c, move all btree reading (and safety checks) into the
btree_read() function.  Also, add a forgotten free() for the type of
grokked record.

Then in both mandocdb.c and apropos_db.c, make the "rec" field of the
btree by in network-order.

13 years agoFix mandocdb(8) to pass over the type when pruning the database. This
Kristaps Dzonsons [Thu, 1 Dec 2011 21:05:49 +0000 (21:05 +0000)]
Fix mandocdb(8) to pass over the type when pruning the database.  This
fixed `-d' perpetually adding the same files.  While here, clean up the
code and document it.  Remove -vv (complain if you want it back in).
Document the error messages in a DIAGNOSTICS section of mandocdb(8).

13 years agoAdd whatis(1) to www and start version information.
Kristaps Dzonsons [Tue, 29 Nov 2011 11:21:47 +0000 (11:21 +0000)]
Add whatis(1) to www and start version information.
While here, change "mdoc macro compiler" to "UNIX manpage compiler", which
is more correct.  I'm not sold on this language; I may end up just going
with mandoc(1)'s notation.
Note also that our archives are now hosted at gmane.

13 years agoNote that mandocdb(8) record type is 64-bit and show all possible values.
Kristaps Dzonsons [Tue, 29 Nov 2011 11:17:47 +0000 (11:17 +0000)]
Note that mandocdb(8) record type is 64-bit and show all possible values.
Also slightly clarify the role of mdoc/man/cat.  Finally, remove mandoc(1)
reference (it's not mentioned in the manual).

13 years agoSnip some whitespace from apropos(1) and remove mandoc(1) ref from
Kristaps Dzonsons [Tue, 29 Nov 2011 10:59:19 +0000 (10:59 +0000)]
Snip some whitespace from apropos(1) and remove mandoc(1) ref from
whatis(1) (both apropos/whatis aren't related to mandoc from an
operator's perspective).

13 years agoMake `-i' only apply to regular expressions. For the equality operator
Kristaps Dzonsons [Tue, 29 Nov 2011 10:53:42 +0000 (10:53 +0000)]
Make `-i' only apply to regular expressions.  For the equality operator
(and thus the default), always use strcasestr().  Discussed on tech@
with schwarze@.  While here, fix the apropos.c usage() message to be
consistent with apropos(1) and clean up the EXAMPLES in apropos(1).

13 years agoAdd tables of matchable keys into apropos.1. Ok and with feedback by
Kristaps Dzonsons [Tue, 29 Nov 2011 00:41:33 +0000 (00:41 +0000)]
Add tables of matchable keys into apropos.1.  Ok and with feedback by
schwarze@.

13 years agochdir(2) to the right man page tree before parsing manuals;
Ingo Schwarze [Tue, 29 Nov 2011 00:34:50 +0000 (00:34 +0000)]
chdir(2) to the right man page tree before parsing manuals;
ok kristaps@

13 years agoBackout -DUSE_MANPATH that sneaked in;
Ingo Schwarze [Mon, 28 Nov 2011 10:10:08 +0000 (10:10 +0000)]
Backout -DUSE_MANPATH that sneaked in;
ok kristaps@.

13 years agoTweak whatis(1):
Ingo Schwarze [Mon, 28 Nov 2011 09:44:05 +0000 (09:44 +0000)]
Tweak whatis(1):
* Bugfix: Use all arguments, not just the last one.
* Use 'Nm~' instead of 'Nm,Nd~' to match OpenBSD behaviour.
* For the progname, accept '^whatis', not '^whatis$' to ease testing.
ok kristaps@

13 years agoDiscuss the default behaviour up front before talking about options
Ingo Schwarze [Mon, 28 Nov 2011 01:37:34 +0000 (01:37 +0000)]
Discuss the default behaviour up front before talking about options
modifying it; based on a remark by kristaps@.
While here, mention parsing of unformatted files
and the changed index format and fix a few minor issues.

13 years agoReimplement the global command line options -a and -v
Ingo Schwarze [Sun, 27 Nov 2011 23:27:31 +0000 (23:27 +0000)]
Reimplement the global command line options -a and -v
as static global variables, reducing the maze of arguments
passed around among various static functions.
Suggested by kristaps@.

13 years agoSave the manual type (mdoc, man, or cat) in the index file
Ingo Schwarze [Sun, 27 Nov 2011 23:11:37 +0000 (23:11 +0000)]
Save the manual type (mdoc, man, or cat) in the index file
of the mandoc databases, as suggested by kristaps@.
Given the well-structured code, this is surprisingly simple.

This changes the mandoc.index database format.
Run "sudo mandocdb" to regenerate your databases.

13 years agoRudimentary handling of formatted manuals ("cat pages").
Ingo Schwarze [Sun, 27 Nov 2011 22:57:53 +0000 (22:57 +0000)]
Rudimentary handling of formatted manuals ("cat pages").
Coded on the train back from p2k11 in Budapest.
Kristaps has seen the patch and agreed with the direction.

13 years agoGet us a whatis(1) mode for apropos(1).
Kristaps Dzonsons [Sun, 27 Nov 2011 18:54:01 +0000 (18:54 +0000)]
Get us a whatis(1) mode for apropos(1).
This is from a patch to tech@ as critiqued by schwarze@, checked in to
get the ball rolling.

13 years agoRemoving INSECURE mode. This is a work in progress! Logic for
Kristaps Dzonsons [Sun, 27 Nov 2011 11:46:44 +0000 (11:46 +0000)]
Removing INSECURE mode.  This is a work in progress!  Logic for
formatting manpages is now linked into man.cgi.

13 years agoSync to OpenBSD, mostly gratuitous and whitespace differences,
Ingo Schwarze [Sat, 26 Nov 2011 22:38:11 +0000 (22:38 +0000)]
Sync to OpenBSD, mostly gratuitous and whitespace differences,
but a few serious things as well:
* -M overrides MANPATH
* -m prepends to the path
* put back database close calls that got lost in mandocdb
* missing sys/types.h in manpath.c, needed for size_t
ok kristaps@

13 years agoRename manup(8) to catman(8), which Linux already uses for a similar tool.
Kristaps Dzonsons [Sat, 26 Nov 2011 19:54:13 +0000 (19:54 +0000)]
Rename manup(8) to catman(8), which Linux already uses for a similar tool.

13 years agoStore page titles in the correct case, and by default, only
Ingo Schwarze [Sat, 26 Nov 2011 11:23:56 +0000 (11:23 +0000)]
Store page titles in the correct case, and by default, only
put stuff into the database that man(1) will be able to retrieve.
However, support an option to use all directories and files.
feedback and ok  kristaps@

13 years agoI say that mandocdb(8) uses "man(1)'s method", but it doesn't. It just uses
Kristaps Dzonsons [Thu, 24 Nov 2011 12:54:19 +0000 (12:54 +0000)]
I say that mandocdb(8) uses "man(1)'s method", but it doesn't.  It just uses
the configuration file and ignores MANPATH.  Everybody else uses MANPATH
(being apropos and man), so why shouldn't we?

13 years agoMake a small manual for how to run man.cgi.
Kristaps Dzonsons [Thu, 24 Nov 2011 12:43:34 +0000 (12:43 +0000)]
Make a small manual for how to run man.cgi.
This exists almost entirely to document that /tmp must exist in a jailed
Apache directory for dbopen() not to fail.  This was a massive headache
to track down.

13 years agoLet man.cgi run in two modes:
Kristaps Dzonsons [Thu, 24 Nov 2011 12:27:18 +0000 (12:27 +0000)]
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.

13 years agoHave manup(8) put relative paths in its output man.conf. This lets us
Kristaps Dzonsons [Thu, 24 Nov 2011 12:22:53 +0000 (12:22 +0000)]
Have manup(8) put relative paths in its output man.conf.  This lets us
have arbitrarily-located cache directories for man.cgi.

13 years agoAllow man.conf file to be assignable.
Kristaps Dzonsons [Thu, 24 Nov 2011 10:44:56 +0000 (10:44 +0000)]
Allow man.conf file to be assignable.

13 years agoExport the manpath_manconf() function, slightly reorderng manpath.c while
Kristaps Dzonsons [Thu, 24 Nov 2011 10:43:55 +0000 (10:43 +0000)]
Export the manpath_manconf() function, slightly reorderng manpath.c while
doing so.  This will be used by a jailed man.cgi, as the cache built by
manup(8) creates a man.conf for it to use.

13 years agoAdd manup(8). This runs through mandocdb(8) databases (in the same way that
Kristaps Dzonsons [Thu, 24 Nov 2011 10:33:38 +0000 (10:33 +0000)]
Add manup(8).  This runs through mandocdb(8) databases (in the same way that
apropos(1) does so) and updates an HTML fragment cache for use by man.cgi.
Right now man.cgi is "online" in that it requires mandoc(1) in its path,
but this doesn't work for, say, OpenBSD's apache chroot(1).  This allows
a cache to be maintained.

13 years agoAdd pkgsrc to downstream. Ok'd Thomas Klausner.
Kristaps Dzonsons [Wed, 23 Nov 2011 10:26:37 +0000 (10:26 +0000)]
Add pkgsrc to downstream.  Ok'd Thomas Klausner.

13 years agoFix whitespace in manuals.
Kristaps Dzonsons [Wed, 23 Nov 2011 10:09:30 +0000 (10:09 +0000)]
Fix whitespace in manuals.

13 years agoman.cgi works for the non-jailed case.
Kristaps Dzonsons [Wed, 23 Nov 2011 10:01:04 +0000 (10:01 +0000)]
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.

13 years agoAdjust Makefile for manpath.{c,h} linking.
Kristaps Dzonsons [Wed, 23 Nov 2011 09:56:17 +0000 (09:56 +0000)]
Adjust Makefile for manpath.{c,h} linking.

13 years agoLet apropos_db.h export the volume of manpages for a parsed record.
Kristaps Dzonsons [Wed, 23 Nov 2011 09:55:28 +0000 (09:55 +0000)]
Let apropos_db.h export the volume of manpages for a parsed record.
This is necessary since an array of records can have duplicate record
numbers in different mandoc.index files.
The volume [right now] is just the index of the parsed mandoc.index in
the manpaths.  This is sensible because the order of the manpath is
significant (it's the order of duplicate-named manuals displayed by
man(1)) and is thus not likely to change.

13 years agoHave mandocdb(8) take advantage of manpath.h.
Kristaps Dzonsons [Wed, 23 Nov 2011 09:52:20 +0000 (09:52 +0000)]
Have mandocdb(8) take advantage of manpath.h.
This brings it in line with makewhatis(8), which, like apropos(1), will use
man.conf (or manpath(1)) if no manpath entries are provided.

13 years agoHave apropos(1) take advantage of manpath.h instead of doing the work
Kristaps Dzonsons [Wed, 23 Nov 2011 09:50:40 +0000 (09:50 +0000)]
Have apropos(1) take advantage of manpath.h instead of doing the work
itself.

13 years agoSupport for Open/NetBSD's /etc/man.conf and others' manpath(1).
Kristaps Dzonsons [Wed, 23 Nov 2011 09:47:38 +0000 (09:47 +0000)]
Support for Open/NetBSD's /etc/man.conf and others' manpath(1).
Most of this code (except the manpath part) written by schwarze@.
This isn't hooked into anything yet.

13 years agotypo reported by Steffen Daode Nurpmeso <sdaoden at googlemail dot com>
Ingo Schwarze [Wed, 23 Nov 2011 02:12:24 +0000 (02:12 +0000)]
typo reported by Steffen Daode Nurpmeso <sdaoden at googlemail dot com>
and remove a trailing blank noticed by jmc@

13 years agoUpdate historical record to be historical and not made-up. Data from
Kristaps Dzonsons [Mon, 21 Nov 2011 22:19:23 +0000 (22:19 +0000)]
Update historical record to be historical and not made-up.  Data from
<manpages.bsd.lv/history.html>.  Ok schwarze@ (with modifications) and
Jason McIntyre.

13 years agoInitial support for man.conf/makepath(1).
Kristaps Dzonsons [Sun, 20 Nov 2011 21:36:00 +0000 (21:36 +0000)]
Initial support for man.conf/makepath(1).

13 years agoClarify some behaviour, bringing schwarze@'s patch and mine closer together
Kristaps Dzonsons [Sun, 20 Nov 2011 16:29:50 +0000 (16:29 +0000)]
Clarify some behaviour, bringing schwarze@'s patch and mine closer together
(although I still don't have -M, which is a big piece).

First, the default search path is the cwd.  This will change to use -M
once I look over that code.

If MANPATH is specified, this replaces the cwd.

Both of these are augmented by -m.

If paths don't exist or don't have databases, they're silently ignored.
This makes perfect sense: you may be given a superset of possible paths.
The corner case of no paths (where, say, MANPATH consists of bogus paths
or the cwd is unreadable) simply means that no paths are searched.

13 years agoOoops... tiny type error slipped in.
Kristaps Dzonsons [Sun, 20 Nov 2011 15:45:37 +0000 (15:45 +0000)]
Ooops... tiny type error slipped in.

13 years agoIntegrate a moderately-patched version of schwarze@'s support for multiple
Kristaps Dzonsons [Sun, 20 Nov 2011 15:43:14 +0000 (15:43 +0000)]
Integrate a moderately-patched version of schwarze@'s support for multiple
directories containing mandocdb(8) databases.  Some changes follow:

 (1) don't support -M yet;
 (2) fall back to cwd if no prior manpath has been specified;
 (3) resolve manpages using realpath() to prevent consecutive chdir()'s
     over relative paths;
 (4) note where further error-reporting is required;
 (5) fix leaking memory on exit in several cases.

13 years agoFix white-space in apropos_db.c to make merging cleaner.
Kristaps Dzonsons [Sun, 20 Nov 2011 12:46:53 +0000 (12:46 +0000)]
Fix white-space in apropos_db.c to make merging cleaner.