mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
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>
This commit is contained in:

committed by
Wolfgang Denk

parent
42df1e1618
commit
560d424b6d
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user