1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-16 15:11:52 +00:00

Use err(3). Use .Pa macro for filenames in man page.

This commit is contained in:
Philippe Charnier 1997-07-21 12:08:14 +00:00
parent 78cad0814f
commit bef3ca0315
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27574
4 changed files with 32 additions and 42 deletions

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: fastfind.c,v 1.9 1997/02/22 19:55:45 peter Exp $
*/
@ -153,10 +153,8 @@ fastfind
/* init bigram table */
#ifdef FF_MMAP
if (len < (2*NBG)) {
(void)fprintf(stderr, "database too small: %s\n", database);
exit(1);
}
if (len < (2*NBG))
errx(1, "database too small: %s", database);
for (c = 0, p = bigram1, s = bigram2; c < NBG; c++, len-= 2) {
p[c] = check_bigram_char(*paddr++);
@ -317,10 +315,8 @@ fastfind
counter++;
if (f_limit >= counter)
(void)puts(path);
else {
(void)fprintf(stderr, "[show only %d lines]\n", counter - 1);
exit(0);
}
else
errx(0, "[show only %d lines]", counter - 1);
} else
(void)puts(path);
}

View File

@ -33,19 +33,21 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: locate.c,v 1.9 1997/02/22 19:55:47 peter Exp $
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1995-1996 Wolfram Schneider, Berlin.\n\
@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)locate.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
/*
@ -172,7 +174,7 @@ main(argc, argv)
#ifdef MMAP
f_mmap = 1;
#else
(void)fprintf(stderr, "mmap(2) not implemented\n");
warnx("mmap(2) not implemented");
#endif
break;
case 's': /* stdio lib */
@ -244,9 +246,7 @@ search_fopen(db, s)
if (f_stdin) {
fp = stdin;
if (*(s+1) != NULL) {
(void)fprintf(stderr,
"read database from stdin, use only");
(void)fprintf(stderr, " `%s' as pattern\n", *s);
warnx("read database from stdin, use only `%s' as pattern", *s);
*(s+1) = NULL;
}
}
@ -274,7 +274,7 @@ search_fopen(db, s)
else
fastfind(fp, *s, path_fcodes);
#ifdef DEBUG
(void)fprintf(stderr, "fastfind %ld ms\n", cputime () - t0);
warnx("fastfind %ld ms", cputime () - t0);
#endif
s++;
}
@ -314,7 +314,7 @@ search_mmap(db, s)
else
fastfind_mmap(*s, p, (int)len, path_fcodes);
#ifdef DEBUG
(void)fprintf(stderr, "fastfind %ld ms\n", cputime () - t0);
warnx("fastfind %ld ms", cputime () - t0);
#endif
s++;
}
@ -340,10 +340,10 @@ cputime ()
void
usage ()
{
(void)fprintf(stderr, "usage: locate [-Scims] [-l limit] ");
(void)fprintf(stderr, "[-d database] pattern ...\n\n");
(void)fprintf(stderr, "default database: `%s' or $LOCATE_PATH\n",
_PATH_FCODES);
(void)fprintf(stderr,
"usage: locate [-Scims] [-l limit] [-d database] pattern ...\n\n");
(void)fprintf(stderr,
"default database: `%s' or $LOCATE_PATH\n", _PATH_FCODES);
exit(1);
}

View File

@ -41,14 +41,16 @@
updates the database used by
.Xr locate 1 .
It is typically run once a week by the
.Nm /etc/weekly script.
.Pa /etc/weekly
script.
.Pp
The contents of the newly built database can be controlled by the
.Nm /etc/locate.rc file.
.Pa /etc/locate.rc
file.
.Sh FILES
.Bl -tag -width /var/db/locate.database -compact
.It Pa /var/db/locate.database
the actual database
the default database
.It Pa /etc/locate.rc
the configuration file
.El

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: util.c,v 1.4 1997/02/22 19:55:50 peter Exp $
*/
@ -67,9 +67,9 @@ check_bigram_char(ch)
(ch >= ASCII_MIN && ch <= ASCII_MAX))
return(ch);
(void)fprintf(stderr, "locate database header corrupt, bigram ");
(void)fprintf(stderr, "char outside 0, %d-%d: %d\n",
ASCII_MIN, ASCII_MAX, ch);
errx(1,
"locate database header corrupt, bigram char outside 0, %d-%d: %d",
ASCII_MIN, ASCII_MAX, ch);
exit(1);
}
@ -99,7 +99,7 @@ colon(dbv, path, dot)
/* empty string */
if (*path == '\0') {
(void)fprintf(stderr, "empty database name, ignored\n");
warnx("empty database name, ignored");
return(dbv);
}
@ -240,12 +240,8 @@ getwm(p)
if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
i = ntohl(i);
if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
(void)fprintf(stderr,
"integer out of +-MAXPATHLEN (%d): %d\n",
MAXPATHLEN, i);
exit(1);
}
if (i > MAXPATHLEN || i < -(MAXPATHLEN))
errx(1, "integer out of +-MAXPATHLEN (%d): %d", MAXPATHLEN, i);
}
return(i);
}
@ -268,12 +264,8 @@ getwf(fp)
if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
word = ntohl(word);
if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
(void)fprintf(stderr,
"integer out of +-MAXPATHLEN (%d): %d\n",
MAXPATHLEN, word);
exit(1);
}
if (word > MAXPATHLEN || word < -(MAXPATHLEN))
errx(1, "integer out of +-MAXPATHLEN (%d): %d", MAXPATHLEN, word);
}
return(word);
}