summaryrefslogtreecommitdiffstats
path: root/usr.bin/locate
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-07-21 12:08:14 +0000
committercharnier <charnier@FreeBSD.org>1997-07-21 12:08:14 +0000
commitf85d3627d41f2210f7f56ee192dc55e5b8494610 (patch)
treeb5af41b88b8f452fd788a9424abae6318b638cc8 /usr.bin/locate
parent197677263f866802a535456b9ff9d4a35457b834 (diff)
downloadFreeBSD-src-f85d3627d41f2210f7f56ee192dc55e5b8494610.zip
FreeBSD-src-f85d3627d41f2210f7f56ee192dc55e5b8494610.tar.gz
Use err(3). Use .Pa macro for filenames in man page.
Diffstat (limited to 'usr.bin/locate')
-rw-r--r--usr.bin/locate/locate/fastfind.c14
-rw-r--r--usr.bin/locate/locate/locate.c26
-rw-r--r--usr.bin/locate/locate/locate.updatedb.88
-rw-r--r--usr.bin/locate/locate/util.c26
4 files changed, 32 insertions, 42 deletions
diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c
index c17c6f1..8a46b0f 100644
--- a/usr.bin/locate/locate/fastfind.c
+++ b/usr.bin/locate/locate/fastfind.c
@@ -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);
}
diff --git a/usr.bin/locate/locate/locate.c b/usr.bin/locate/locate/locate.c
index a9bed92..819d8a5 100644
--- a/usr.bin/locate/locate/locate.c
+++ b/usr.bin/locate/locate/locate.c
@@ -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);
}
diff --git a/usr.bin/locate/locate/locate.updatedb.8 b/usr.bin/locate/locate/locate.updatedb.8
index a35c607..69d992b 100644
--- a/usr.bin/locate/locate/locate.updatedb.8
+++ b/usr.bin/locate/locate/locate.updatedb.8
@@ -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
diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c
index 57bd157..87ad02f 100644
--- a/usr.bin/locate/locate/util.c
+++ b/usr.bin/locate/locate/util.c
@@ -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);
}
OpenPOWER on IntegriCloud