Commit Graph

77 Commits

Author SHA1 Message Date
simonb e51f2a44d4 Little clean up: use getopts and don't use ``. Suggested by kre@. 2020-04-25 10:06:42 +00:00
simonb 882a370dc0 Add support for specifying an alternate locate.updatedb config file. 2020-02-06 08:45:44 +00:00
christos d24a806584 fool gcc with strncpy. 2019-10-13 19:39:15 +00:00
lukem 94c0b8f918 locate: fix support for multiple databases
Ensure that the first database is correctly added when
more than one database is provided.

Fixes problem I introduced in rev 1.17 on 2009-04-12,
and noticed recently by Simon.
2018-05-14 05:17:10 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
sevan 39bbc68a3b Drop main() prototype. 2016-09-05 00:40:28 +00:00
apb f80058aa23 Synchronise several shell_quote implementations, and:
* Elide some unnecessary pairs of quotation marks, to improve readability.
  For example, shell_quote "''" is now \'\' instead of ''\'''\'''.
* Don't add quotes around words that contain only safe characters,
  to improve readability.
* LC_COLLATE=C to prevent [a-zA-Z] from matching non-ASCII characters.
* Use ${SED} if defined.
2014-08-04 21:56:30 +00:00
joerg cb377560e8 ANSIfy + static + __dead 2011-09-04 20:28:09 +00:00
apb 8c250ec6f2 Comments and white space changes, inspired by Greg Woods' remarks
in PR 45130, but not directly copied from the patch in the PR.
2011-07-13 07:58:35 +00:00
apb 69e4520422 Fix error in previous: The first character of $i should be removed
only if it is '!', but it was removed in the wrong case branch.
2011-07-13 07:48:19 +00:00
apb 404ff31a48 Allow quoting of embedded shell metacharacters in locate.conf(5).
The shell_quote function here is identical to that in postinstall
and etcupdate.

This should fix PR 45130 from Greg Woods.
2011-07-10 13:42:49 +00:00
joerg 762152502e Reorder sections to canonical order. 2010-05-14 17:06:40 +00:00
drochner 884c70cd50 ANSIfy, sprinkle "const" in some obvious cases 2009-11-17 18:31:12 +00:00
lukem 6533b9aa4b Fix WARNS=4 issues 2009-04-12 13:53:02 +00:00
hubertf 4841b75981 sign over my copyright to TNF 2008-09-22 13:10:25 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
msaitoh 8ce1f4fff2 fix typos 2007-04-29 20:23:34 +00:00
christos 328064d112 Redo the previous change so that we can ignore access errors from find,
but also tell when writing to the output file failed, by using a pipeline
to cat. While here change `` to $(). Otherwise this would always fail
since it is ran as nobody and therefore it cannot access some files. Reported
by smb.
2006-04-23 03:04:08 +00:00
dyoung dd269ac542 This patch removes one possible cause for a prolonged "out of disk"
condition on /tmp/:  if creating the file list ($FILELIST) fails,
immediately exit with a non-zero result code.  This fixes a bug
where, if the file list filled /tmp/, updatedb.sh would nevertheless
run for several minutes before it removed the file list as it quit.
2006-02-26 03:00:16 +00:00
christos 557f9b049f PR/32799: David H. Gutteridge: Apparent off-by-one error in locate(1) causes
incorrect behaviour when entries with the maximum path length are encountered
2006-02-12 00:45:01 +00:00
hubertf 8457054037 Make it clear where this program can be found.
Requested by wiz.
2005-10-05 17:38:49 +00:00
hubertf e533c36a54 Add locate.updatedb(8).
Discovered missing while sorting things out for BSDcertification.org.
Ran through wizd(8).
2005-10-05 06:29:03 +00:00
lukem 1efa87943c Rework "ignorefs" behaviour:
*	types are added to (rather than overriding) the default list
    *	Still use "ignorefs none" to clear the list (including the default list)
    *	Fix argument parsing when using "none"
This makes "ignorefs" much more useful if you just want to add another
fstype to the default list.

Simplify variable assignment.
2004-04-19 01:05:22 +00:00
lukem 1df7609f71 xref locate.conf(5) 2004-04-19 00:32:44 +00:00
itohy 0822f845c4 Use /etc/locate.conf for configuration, per discussion at tech-userlevel. 2004-02-06 14:29:51 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
christos dfeeeb0064 remove -g accidentally committed 2003-04-07 04:01:32 +00:00
christos 0a5854c253 - stricter bad file format checks
- KNF
- use LIST macros
2003-04-07 04:00:59 +00:00
wiz 2572f504d7 Replace > by \*[Gt] for HTML output. 2003-04-05 17:57:47 +00:00
perry 87cbf08503 Move exit status information to EXIT STATUS section, and note that we
exit >0 if errors such as missing or corrupted database files are
encountered.
2003-04-05 16:46:00 +00:00
perry fa066122ba 1) print an error and exit if fed a directory as a database
Patch submitted by Soren Jacobsen in PR bin/21016, but
   heavily edited by me.
2) error and exit out if you can't open a database instead of just
   warning and going on.
2003-04-05 16:36:38 +00:00
christos cf0848bff3 PR/13629: Rick Byers: Don't trust data from the database file. 2003-04-03 01:20:26 +00:00
lukem 5d4973fe97 makefile delint. use NETBSDSRCDIR as appropriate 2002-09-18 14:00:33 +00:00
kim 21e9aa7fd6 Quote $FILELIST and $BIGRAMS consistently. Especially the latter
can elicit "usage" from locate.code at runtime.
2002-05-05 07:27:35 +00:00
tv 8e6f7afb5b MKfoo=no -> NOfoo 2001-12-12 01:48:43 +00:00
wiz e8ae3ab788 Empty line -> .Pp. 2001-12-01 20:33:02 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
lukem 22fed3d22d exclude cd9660 and procfs as well. fixes PRs [bin/8454] and [bin/14006] 2001-11-07 15:31:41 +00:00
lukem c72849267d use mktemp(1) to safely create the temporary file.
fixes [security/12915] from David Sainty.
2001-06-18 11:10:25 +00:00
jdolecek ef163d60fa Trap also SIGHUP and SIGQUIT. Suggested by Jim Bernard & Christos
some time ago.
2001-05-14 14:58:59 +00:00
jdolecek 5cf4138b21 Don't exit with status 1 for successfull (non-interrupted) run.
Reported and patch provided in bin/12372 by Jim Bernard.
2001-03-12 13:29:26 +00:00
mycroft 73816a58f3 Do not count the end of a line in the bigram table. Newlines are stripped
before coding anyway, and the bigram output was screwing up (and often
pessimising) the table.
2000-05-06 10:26:45 +00:00
mycroft e8509e9145 Adjust the previous change to not generate garbage databases. 2000-05-06 10:02:06 +00:00
mycroft e29ea15050 Always wrap the bigram string in double quotes, in case it contains spaces.
Some other trivial cleanup.
2000-04-29 21:41:19 +00:00
jdolecek 5ab45b31f7 Convert updatedb script from C-shell to bourne shell. 2000-04-20 15:40:28 +00:00
simonb a04e169a80 Include <string.h> to get a prototype for memset(). Fixes build
problems on alpha noted by Tim Rightnour on current-users.
2000-03-22 21:45:02 +00:00
jdolecek 79176095e8 locate.bigram does all the bigram processing itself now; store it's result
in local variable and pass the value to locate.code directly instead
of using temporary file

always remove $filelist, even if an error is encountered
2000-03-20 19:22:55 +00:00
jdolecek e3f9e89eb9 the first args is expected to be the bigrams array, instead of name of
file holding it
2000-03-20 19:18:34 +00:00
jdolecek a46f4702f8 Do all bigram processing here, instead of in updatedb.csh; saves
a few cycles (it's runs like 2 seconds instead of 16) and the algorithm
is hopefully a bit more clear
2000-03-20 19:17:35 +00:00
jdolecek c3678e83f5 s/appears/appeared/ 2000-03-10 15:15:32 +00:00