blob: 758f5b4b9fdb3d795ec40186293816d9b7d7760b [file] [log] [blame]
Jari Aaltod166f041997-06-05 14:59:13 +00001/* hashcmd.h - Common defines for hashing filenames. */
Jari Aalto726f6381996-08-26 18:22:31 +00002
Jari Aalto31859422009-01-12 13:36:28 +00003/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
Jari Aalto726f6381996-08-26 18:22:31 +00004
5 This file is part of GNU Bash, the Bourne Again SHell.
6
Jari Aalto31859422009-01-12 13:36:28 +00007 Bash is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
Jari Aalto726f6381996-08-26 18:22:31 +000011
Jari Aalto31859422009-01-12 13:36:28 +000012 Bash is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
Jari Aalto726f6381996-08-26 18:22:31 +000016
Jari Aalto31859422009-01-12 13:36:28 +000017 You should have received a copy of the GNU General Public License
18 along with Bash. If not, see <http://www.gnu.org/licenses/>.
19*/
Jari Aalto726f6381996-08-26 18:22:31 +000020
Jari Aaltobb706242000-03-17 21:46:59 +000021#include "stdc.h"
Jari Aaltod166f041997-06-05 14:59:13 +000022#include "hashlib.h"
Jari Aalto726f6381996-08-26 18:22:31 +000023
Jari Aalto7117c2d2002-07-17 14:10:11 +000024#define FILENAME_HASH_BUCKETS 64 /* must be power of two */
Jari Aalto726f6381996-08-26 18:22:31 +000025
26extern HASH_TABLE *hashed_filenames;
27
Jari Aalto31859422009-01-12 13:36:28 +000028typedef struct _pathdata {
Jari Aalto726f6381996-08-26 18:22:31 +000029 char *path; /* The full pathname of the file. */
Jari Aaltoccc6cda1996-12-23 17:02:34 +000030 int flags;
Jari Aalto726f6381996-08-26 18:22:31 +000031} PATH_DATA;
32
Jari Aaltoccc6cda1996-12-23 17:02:34 +000033#define HASH_RELPATH 0x01 /* this filename is a relative pathname. */
34#define HASH_CHKDOT 0x02 /* check `.' since it was earlier in $PATH */
35
Jari Aalto726f6381996-08-26 18:22:31 +000036#define pathdata(x) ((PATH_DATA *)(x)->data)
Jari Aaltod166f041997-06-05 14:59:13 +000037
Jari Aalto7117c2d2002-07-17 14:10:11 +000038extern void phash_create __P((void));
39extern void phash_flush __P((void));
40
41extern void phash_insert __P((char *, char *, int, int));
42extern int phash_remove __P((const char *));
43extern char *phash_search __P((const char *));