diff options
| author | Mike Frysinger <vapier@gentoo.org> | 2010-12-17 16:51:59 -0500 | 
|---|---|---|
| committer | Wolfgang Denk <wd@denx.de> | 2011-01-09 17:57:37 +0100 | 
| commit | 560d424b6d7cd4205b062ad95f1b104bd4f8bcc3 (patch) | |
| tree | 5a429e36ad18a8fa2e0b026d143c38d7f3d493af /lib/hashtable.c | |
| parent | 42df1e1618f2bcae308ad193a136b72b82103bea (diff) | |
| download | olio-uboot-2014.01-560d424b6d7cd4205b062ad95f1b104bd4f8bcc3.tar.xz olio-uboot-2014.01-560d424b6d7cd4205b062ad95f1b104bd4f8bcc3.zip | |
env: re-add support for auto-completion
Currently, only basic completion is supported (no globs), but this is
what we had previously.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'lib/hashtable.c')
| -rw-r--r-- | lib/hashtable.c | 20 | 
1 files changed, 20 insertions, 0 deletions
| diff --git a/lib/hashtable.c b/lib/hashtable.c index b47f3b69b..9f069c076 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -202,6 +202,26 @@ void hdestroy_r(struct hsearch_data *htab)   *   example for functions like hdelete().   */ +int hmatch_r(const char *match, int last_idx, ENTRY ** retval, +	     struct hsearch_data *htab) +{ +	unsigned int idx; +	size_t key_len = strlen(match); + +	for (idx = last_idx + 1; idx < htab->size; ++idx) { +		if (!htab->table[idx].used) +			continue; +		if (!strncmp(match, htab->table[idx].entry.key, key_len)) { +			*retval = &htab->table[idx].entry; +			return idx; +		} +	} + +	__set_errno(ESRCH); +	*retval = NULL; +	return 0; +} +  int hsearch_r(ENTRY item, ACTION action, ENTRY ** retval,  	      struct hsearch_data *htab)  { |