+/* $OpenBSD: kvm_mkdb.c,v 1.2 1997/01/15 22:08:15 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
#endif /* not lint */
#ifndef lint
-/*static char sccsid[] = "from: @(#)kvm_mkdb.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: kvm_mkdb.c,v 1.1.1.1 1995/10/18 08:47:39 deraadt Exp $";
+#if 0
+static char sccsid[] = "from: @(#)kvm_mkdb.c 8.1 (Berkeley) 6/6/93";
+#else
+static char *rcsid = "$OpenBSD: kvm_mkdb.c,v 1.2 1997/01/15 22:08:15 millert Exp $";
+#endif
#endif /* not lint */
#include <sys/param.h>
int ch;
char *p, *nlistpath, *nlistname, dbtemp[MAXPATHLEN], dbname[MAXPATHLEN];
- while ((ch = getopt(argc, argv, "")) != EOF)
+ while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
case '?':
default:
if (testdb())
exit(0);
-#define basename(cp) ((p = rindex((cp), '/')) != NULL ? p + 1 : (cp))
+#define basename(cp) ((p = strrchr((cp), '/')) != NULL ? p + 1 : (cp))
nlistpath = argc > 0 ? argv[0] : _PATH_UNIX;
nlistname = basename(nlistpath);
+/* $OpenBSD: nlist.c,v 1.6 1997/01/15 22:08:16 millert Exp $ */
+
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)nlist.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: nlist.c,v 1.5 1996/07/31 17:21:47 deraadt Exp $";
+#if 0
+static char sccsid[] = "from: @(#)nlist.c 8.1 (Berkeley) 6/6/93";
+#else
+static char *rcsid = "$OpenBSD: nlist.c,v 1.6 1997/01/15 22:08:16 millert Exp $";
+#endif
#endif /* not lint */
#include <sys/param.h>
+/* $OpenBSD: testdb.c,v 1.2 1997/01/15 22:08:17 millert Exp $ */
+
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*/
#ifndef lint
-/*static char sccsid[] = "from: @(#)testdb.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$Id: testdb.c,v 1.1.1.1 1995/10/18 08:47:39 deraadt Exp $";
+#if 0
+static char sccsid[] = "from: @(#)testdb.c 8.1 (Berkeley) 6/6/93";
+#else
+static char *rcsid = "$OpenBSD: testdb.c,v 1.2 1997/01/15 22:08:17 millert Exp $";
+#endif
#endif /* not lint */
#include <sys/param.h>
goto close;
uf = _PATH_UNIX;
- if ((cp = rindex(uf, '/')) != 0)
+ if ((cp = strrchr(uf, '/')) != 0)
uf = cp + 1;
- (void) snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf);
+ (void)snprintf(dbname, sizeof(dbname), "%skvm_%s.db", _PATH_VARDB, uf);
if ((db = dbopen(dbname, O_RDONLY, 0, DB_HASH, NULL)) == NULL)
goto close;
rec.size = sizeof(VRS_KEY) - 1;
if ((db->get)(db, &rec, &rec, 0))
goto close;
- if (rec.data == 0 || rec.size > sizeof(dbversion))
+ if (rec.data == 0 || rec.size == 0 || rec.size > sizeof(dbversion))
goto close;
- bcopy(rec.data, dbversion, rec.size);
+ (void)memcpy(dbversion, rec.data, rec.size);
dbversionlen = rec.size;
/* Read version string from kernel memory */
goto close;
if (rec.data == 0 || rec.size != sizeof(struct nlist))
goto close;
- bcopy(rec.data, &nitem, sizeof(nitem));
+ (void)memcpy(&nitem, rec.data, sizeof(nitem));
/*
* Theoretically possible for lseek to be seeking to -1. Not
* that it's something to lie awake nights about, however.
goto close;
/* If they match, we win */
- ret = bcmp(dbversion, kversion, dbversionlen) == 0;
+ ret = memcmp(kversion, dbversion, dbversionlen) == 0;
close: if (kd >= 0)
(void)close(kd);