Commit Graph

77 Commits

Author SHA1 Message Date
christos e3b62f5882 Only include libutil if !HOSTPROG 2006-08-30 12:11:40 +00:00
christos 5a7156cc58 use efun(3) 2006-08-26 18:18:16 +00:00
chuck d09fe2c467 modified man(1):
- avoid double slashes when displaying man pages (got tired
   of '/usr/share/man//cat1/man.0').
 - got rid of __P() while working on it.
 - incorporate some of my old notes explaining how manpath works into the
   comments of the code itself.
 - renamed some of the vars so that the code is consistent throughout
   (and hopefully clearer and easier to understand)
 - fixed relative man paths for multiple man pages (man did a chdir()
   on the first man page it had to format --- this broke any remaining
   relative path man pages left to process).   save old directory and
   fchdir() back to it after formatting.
 - improved doc on "man -h" which does more than just whatis(1) [e.g.
   "man -h fopen" prints the required include files and the prototypes
   rather than just the one-liner you get with whatis(1)]
 - manconf.c now fills in the "len" length field in the TAG/ENTRY
   structures (man now uses len).

revise man.conf file reading stuff to return error on failure in
addentry/gettag (fka getlist) rather than just err()ing out.   this
allows man(1) to call cleanup and delete its tmp files rather than
just leave them floating.  revise other apps using this code
(makewhatis, apropos, catman, whatis) to expect this.  also remove
__P on updated files.
2006-04-10 14:39:06 +00:00
christos ef66965d63 Deal with fts errors properly. 2005-11-18 17:12:09 +00:00
tron 19577e1cae Reject unformatted manual pages with "[" characters in the description
because "makewhatis" cannot handle nroff macros properly. This fixes
the result of "apropos chrtbl". Problem pointed out by wizd(8)
in private e-mail.
2005-09-15 14:20:01 +00:00
lukem 818f7c82fa appease gcc -Wuninitialized 2005-06-01 15:51:23 +00:00
wiz 4dd1b491d0 Sync usage with man page. 2005-04-04 08:13:52 +00:00
wiz 0652314a20 Some cleanups, use more markup. 2005-04-04 08:13:27 +00:00
christos 183cc62f03 Make it parse old man pages, new mdoc pages, broken pages, and pages where
the synopsis line does not give us the section number. Add -w flag to print
pages we still don't like. Now we parse 99% of the pages properly.
2005-04-03 21:32:45 +00:00
christos 715420b601 remove debugging printfs. 2005-04-03 20:31:18 +00:00
christos 79519a3a20 Cat pages end up looking like "page -- description", so substitute "--" for
the section page. This makes things look right again, and avoids duplicates.
2005-04-03 20:30:39 +00:00
dsl 1869f0e146 Add (unsigned char) cast to ctype functions 2004-11-05 21:56:01 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
salo 99410184e7 netbsd.org->NetBSD.org 2003-07-26 19:24:24 +00:00
itojun 1d041f9dd7 use bounded string op (some remains) 2003-07-13 12:04:45 +00:00
wiz 9e7c0f3178 Do not hardcode "nroff", allow it to be overridden by defining NROFF. Useful for tools/makewhatis. 2003-06-14 17:56:24 +00:00
wiz fee392c197 Report on which file nroff returned an error. 2003-06-14 16:58:00 +00:00
lukem 826a14607a Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
2003-05-18 07:57:31 +00:00
lukem bafe5da620 use bsd.own.mk instead of the (obvious typo of) bsd.obj.mk 2002-09-18 06:24:33 +00:00
thorpej 7c96dd1581 Rename man/config.{c,h} to man/manconf.{c,h}, so we don't have to
worry about problems including "config.h" when building as a host
tool.
2002-09-13 15:56:37 +00:00
junyoung 937e5f4f83 Previous commit broke the normal build; this should really fix the
problem, toolchain/18020. From Frederick Bruckman <fredb@immanent.net>.
2002-09-04 16:57:47 +00:00
junyoung 9cc71f17e2 Fix a problem that 'make obj' doesn't work within tools/makewhatis. 2002-09-04 06:39:58 +00:00
lukem f794aa60bb Use ${NETBSDSRCDIR}/some/path instead of ${.CURDIR}/../../some/path 2002-08-19 13:54:34 +00:00
tron 97f197cc4e Adapt to lastest changes of configuration handling in man(1). 2002-06-11 09:58:50 +00:00
jdolecek 5147204191 remove - the C version diverged enough for this to not be
full-featured replacement
2002-03-10 20:46:42 +00:00
jdolecek f004775535 fix behaviour if exactly one directory is specified (off-by-one error)
this caused makewhatis behave as if called without arguments at all

Problem reported by Xavier HUMBERT on current-users.
2002-03-10 20:36:10 +00:00
wiz d367bf3547 Grammar and mdoc fixes. 2002-03-08 22:10:00 +00:00
jdolecek 534dd161ea If called without arguments, parse /etc/man.conf and regenerate the whatis
databases specified there. By default, the individual databases
are actually generated by forked children in this case, for
performance reasons. This feature can be switched off by new -f flag.
If the configuration file can't be parsed or doesn't contain any
_whatdb entries, the code falls back to /usr/share/man as before.

Added -C, which allows to specify alternate configuration file. This
  is compatible with apropos(1) and whatis(1) flag of same name.

Update manpage accordingly and document behaviour a bit better.
Also add a HISTORY section, hopefully correct (done using CVS logs).

This solves toolchain/5231 by Tim Rightnour and bin/7696 by Allen Briggs.
2002-03-08 21:59:07 +00:00
jdolecek c8c145f7da Make the whatis enties prefixed with man subdirectory the manpage
appears in, as commonly used for architecture-specific manpages.
The subdirectory is deliberately printed such that the entry is suitable
for cut&paste for man(1).

Fixes bin/9744 by John Hawkinson and misc/14997 by Hiramatsu Yoshifumi.
2002-03-07 20:37:14 +00:00
tv 9fbd88883c Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
  sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
2002-01-31 22:43:33 +00:00
tv a328e34106 Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
2002-01-29 10:20:28 +00:00
tron ace258d3b2 Handle ".Xr" commands with text after the section number probably.
This fixes PR bin/15253 by Thomas Klausner.
2002-01-21 12:21:31 +00:00
wiz 02dda53455 Whitespace nit, mark up AUTHORS section, use standard headers, sort sections, end sentences with dots. 2002-01-15 02:24:15 +00:00
christos 94faea123b - fix whitespace nits.
- change error checking philosophy: instead of returning errors to the
  upper layer only to fail silently and exit there, or die of unexpected
  NULL pointers bail out and print an error immediately. Add emalloc/estrdup
  to simplify. This change removed a bunch of code.
- fix size_t/int confusion
- cast argument to isspace(3) to unsigned char
- ? : statement is not an lvalue, so don't take its address.
- unlink the file before we open it, because we chmod it to readonly.
- misc KNF
2002-01-11 18:33:03 +00:00
thorpej 65709d507f Allow this to be built as a host program. 2001-11-29 23:50:12 +00:00
tron 04a7d6cb3e Avoid strange error message in case of corrupted manual page files. 2001-11-23 13:18:54 +00:00
tron 37dcd07159 Strip overstrike characters from input lines while searching for a "NAME"
section in a formatted manual page. "makewhatis" now recognizes and indexes
the OpenSSL manual pages properly. Fixes PR bin/12390 by Hubert Feyrer.
2001-04-10 21:00:00 +00:00
tron 3849906202 Abort parsing and invoke "nroff" if an unsupported macro is found in the
description section of an unformatted manual page. While this makes the
"makewhatis" two times slower in avoids creation of several incorrect
entries in the "whatis.db" database. This fixes PR bin/12535 by
Thomas Klausner.
2001-04-08 14:49:32 +00:00
tron fd7e4484fc - Use ".TH" lines in unformatted manual pages to find correct section
number.
- Always invoke "nroff" if builtin parser for unformatted manual pages
  fails and try to parse formatted manual page.
2001-04-08 14:27:50 +00:00
cgd 65a1026492 convert to use getprogname() 2001-02-19 22:43:42 +00:00
tron 7cae32ff49 Invoke "nroff" with "-S" (safer mode) option because "makewhatis" is
usually invoked by "root".
2000-07-13 06:45:22 +00:00
tron 714c921491 Kill "nroff" process and wait for its terminiation if we can't setup
the "libz" file handle.
2000-07-13 06:29:43 +00:00
tron b238c131ce Optimize invokation of "nroff":
- Redirect standard error to "/dev/null" because "nroff" error messages
  for temporary files aren't really useful.
- Don't let "nroff" open temporary file. Use its file descriptor as
  standard input.
2000-07-13 06:15:03 +00:00
tron e6f40b0f96 Check exit code returned from "nroff" if it is used to convert
unformatted manual pages.
2000-07-10 08:11:31 +00:00
tron 93cb6f8300 Invoke "nroff" and parse its output if an unformatted manual page uses
macros. Fixes PR bin/9083 by Geoff C. Wing.
2000-07-09 23:07:14 +00:00
tron 91e1f3f01b Don't write leading white spaces and directory names to whatis file. 2000-01-24 23:03:54 +00:00
tron e9a72ad0a3 Accept all kind of whitespaces when searching for the end of a nroff
macro.
1999-12-31 14:50:16 +00:00
tron 3434166ef3 Correct and improve nroff macro stripping. Partially fixes PR bin/9083
by Geoff C. Wing.
1999-12-31 14:28:03 +00:00
tron a0ed22ea5f Recognize manual page sections "l" and "n" used by the package system.
This fixes PR bin/8977 by Thilo Manske.
1999-12-11 20:30:30 +00:00
tron 9cc91f68f9 Set file modes of whatis.db database file to 444 like the old script did. 1999-09-25 21:40:58 +00:00