Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2]: src/usr.bin/cap_mkdb Pull up following revision(s) (requested...
details: https://anonhg.NetBSD.org/src/rev/97502be0ef1c
branches: netbsd-2
changeset: 564335:97502be0ef1c
user: riz <riz%NetBSD.org@localhost>
date: Mon Nov 14 22:00:36 2005 +0000
description:
Pull up following revision(s) (requested by christos in ticket #5978):
usr.bin/cap_mkdb/cap_mkdb.c: revision 1.21
const, knf, WARNS=3
diffstat:
usr.bin/cap_mkdb/cap_mkdb.c | 35 ++++++++++++++++++-----------------
1 files changed, 18 insertions(+), 17 deletions(-)
diffs (112 lines):
diff -r 04e95f2119bb -r 97502be0ef1c usr.bin/cap_mkdb/cap_mkdb.c
--- a/usr.bin/cap_mkdb/cap_mkdb.c Sun Nov 06 00:51:13 2005 +0000
+++ b/usr.bin/cap_mkdb/cap_mkdb.c Mon Nov 14 22:00:36 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cap_mkdb.c,v 1.20 2003/10/27 00:12:43 lukem Exp $ */
+/* $NetBSD: cap_mkdb.c,v 1.20.4.1 2005/11/14 22:00:36 riz Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95";
#endif
-__RCSID("$NetBSD: cap_mkdb.c,v 1.20 2003/10/27 00:12:43 lukem Exp $");
+__RCSID("$NetBSD: cap_mkdb.c,v 1.20.4.1 2005/11/14 22:00:36 riz Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -55,16 +55,16 @@
#include <unistd.h>
#include <ctype.h>
-static void db_build (char **);
-static void dounlink (void);
-static void usage (void);
+static void db_build(const char **);
+static void dounlink(void);
+static void usage(void) __attribute__((__unused__));
static int count_records(char **);
-DB *capdbp;
-int verbose;
-char *capdb, *capname, buf[8 * 1024];
+static DB *capdbp;
+static int verbose;
+static char *capname, buf[8 * 1024];
-HASHINFO openinfo = {
+static HASHINFO openinfo = {
4096, /* bsize */
16, /* ffactor */
2048, /* nelem */
@@ -134,12 +134,12 @@
if (atexit(dounlink))
err(1, "atexit");
- db_build(argv);
+ db_build((const char **)argv);
if (capdbp->close(capdbp) < 0)
err(1, "%s", capname);
capname = NULL;
- exit(0);
+ return 0;
}
static void
@@ -162,7 +162,7 @@
* details above.
*/
static void
-db_build(char **ifiles)
+db_build(const char **ifiles)
{
DBT key, data;
recno_t reccnt;
@@ -205,7 +205,7 @@
}
/* Create the stored record. */
- memmove(&((u_char *)(data.data))[1], bp, len + 1);
+ (void)memmove(&((u_char *)(data.data))[1], bp, len + 1);
data.size = len + 2;
/* Store the record under the name field. */
@@ -229,7 +229,7 @@
/* The rest of the names reference the entire name. */
((char *)(data.data))[0] = SHADOW;
- memmove(&((u_char *)(data.data))[1], key.data, key.size);
+ (void)memmove(&((u_char *)(data.data))[1], key.data, key.size);
data.size = key.size + 1;
/* Store references for other names. */
@@ -270,7 +270,8 @@
usage(void)
{
(void)fprintf(stderr,
- "usage: cap_mkdb [-b|-l] [-v] [-f outfile] file1 [file2 ...]\n");
+ "Usage: %s [-b|-l] [-v] [-f outfile] file1 [file2 ...]\n",
+ getprogname());
exit(1);
}
@@ -289,7 +290,7 @@
/* scan input files and count individual records */
for(nelem = 0, slash = 0; *list && (fp = fopen(*list++, "r")); ) {
- while((line = fgetln(fp, &len))) {
+ while((line = fgetln(fp, &len)) != NULL) {
if (len < 2)
continue;
if (!isspace((unsigned char) *line) && *line != ':'
@@ -298,7 +299,7 @@
slash = (line[len - 2] == '\\');
}
- fclose(fp);
+ (void)fclose(fp);
}
if (nelem == 0) {
Home |
Main Index |
Thread Index |
Old Index