summaryrefslogtreecommitdiff
path: root/lib/libc/gen/elf_hash.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-29 03:05:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-29 03:05:15 +0000
commit92383d4847f9886583809f9d430a3411aa6e925c (patch)
tree8dd61408135e5791358ad10abf3336e19c8c52f9 /lib/libc/gen/elf_hash.c
parent84caeb3aa64af21636ab0464cce327de7bc4cc78 (diff)
enable ELF/a.out/ECOFF in machine/exec.h
Diffstat (limited to 'lib/libc/gen/elf_hash.c')
-rw-r--r--lib/libc/gen/elf_hash.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/lib/libc/gen/elf_hash.c b/lib/libc/gen/elf_hash.c
index 3ed039f5d00..a5655f7ebf8 100644
--- a/lib/libc/gen/elf_hash.c
+++ b/lib/libc/gen/elf_hash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf_hash.c,v 1.1 1996/05/28 14:11:20 etheisen Exp $ */
+/* $OpenBSD: elf_hash.c,v 1.2 1996/05/29 03:05:12 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen
* All rights reserved.
@@ -25,6 +25,19 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/exec.h>
+
#include <elf_abi.h>
/*
@@ -34,16 +47,15 @@
*/
unsigned long
elf_hash(name)
- const unsigned char *name;
+ const unsigned char *name;
{
- register unsigned long h = 0, g;
+ register unsigned long h = 0, g;
- while(*name)
- {
- h = (h << 4) + *name++;
- if (g = h & 0xf0000000)
- h ^= g >> 24;
- h &= ~g;
- }
- return h;
-} /* end elf_hash() */
+ while (*name) {
+ h = (h << 4) + *name++;
+ if (g = h & 0xf0000000)
+ h ^= g >> 24;
+ h &= ~g;
+ }
+ return h;
+}