BSD 4_4 release
[unix-history] / usr / src / old / libndbm / ndbm.c
index 74bba56..1734fe4 100644 (file)
@@ -1,31 +1,36 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1983 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
  */
 
  */
 
-#ifndef lint
-static char sccsid[] = "@(#)ndbm.c     5.2 (Berkeley) %G%";
-#endif not lint
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ndbm.c     5.7 (Berkeley) 4/22/91";
+#endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <stdio.h>
 #include <errno.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <stdio.h>
 #include <errno.h>
-#include <ndbm.h>
+#include "ndbm.h"
 
 #define BYTESIZ 8
 #undef setbit
 
 
 #define BYTESIZ 8
 #undef setbit
 
-static  datum makdatum();
-static  long hashinc();
-static  long dcalchash();
-extern  int errno;
+static datum makdatum();
+static long hashinc();
+static long dcalchash();
+static int additem(), delitem(), finddatum(), getbit();
+static void dbm_access(), setbit();
+extern int errno;
 
 DBM *
 dbm_open(file, flags, mode)
 
 DBM *
 dbm_open(file, flags, mode)
-       char *file;
+       const char *file;
        int flags, mode;
 {
        struct stat statb;
        int flags, mode;
 {
        struct stat statb;
@@ -261,7 +266,7 @@ err:
        return (item);
 }
 
        return (item);
 }
 
-static
+static void
 dbm_access(db, hash)
        register DBM *db;
        long hash;
 dbm_access(db, hash)
        register DBM *db;
        long hash;
@@ -308,7 +313,7 @@ getbit(db)
        return (db->dbm_dirbuf[i] & (1<<n));
 }
 
        return (db->dbm_dirbuf[i] & (1<<n));
 }
 
-static
+static void
 setbit(db)
        register DBM *db;
 {
 setbit(db)
        register DBM *db;
 {
@@ -496,7 +501,7 @@ additem(buf, item, item1)
        if (i2 > 0)
                i1 = sp[i2];
        i1 -= item.dsize + item1.dsize;
        if (i2 > 0)
                i1 = sp[i2];
        i1 -= item.dsize + item1.dsize;
-       if (i1 <= (i2+3) * sizeof(short))
+       if (i1 <= (i2+3) * (int)sizeof(short))
                return (0);
        sp[0] += 2;
        sp[++i2] = i1 + item1.dsize;
                return (0);
        sp[0] += 2;
        sp[++i2] = i1 + item1.dsize;