xref: /titanic_44/usr/src/cmd/sh/hash.h (revision 587032cf0967234b39ccb50adca936a367841063)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 1990 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
29 /*	  All Rights Reserved  	*/
30 
31 #ifndef	_HASH_H
32 #define	_HASH_H
33 
34 #pragma ident	"%Z%%M%	%I%	%E% SMI"
35 /*
36  *	UNIX shell
37  */
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 #define		HASHZAP		0x03FF
43 #define		CDMARK		0x8000
44 
45 #define		NOTFOUND		0x0000
46 #define		BUILTIN			0x0100
47 #define		FUNCTION		0x0200
48 #define		COMMAND			0x0400
49 #define		REL_COMMAND		0x0800
50 #define		PATH_COMMAND	0x1000
51 #define		DOT_COMMAND		0x8800	/* CDMARK | REL_COMMAND */
52 
53 #define		hashtype(x)	(x & 0x1F00)
54 #define		hashdata(x)	(x & 0x00FF)
55 
56 
57 typedef struct entry
58 {
59 	unsigned char	*key;
60 	short	data;
61 	unsigned char	hits;
62 	unsigned char 	cost;
63 	struct entry	*next;
64 } ENTRY;
65 
66 extern ENTRY	*hfind();
67 extern ENTRY	*henter();
68 extern void	hcreate(void);
69 
70 #ifdef	__cplusplus
71 }
72 #endif
73 
74 #endif /* !_HASH_H */
75