diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-06-09 00:03:53 +0800 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-04-30 20:37:40 +0800 |
commit | b7fc51bd793467d72695e0b18151e05a551ed152 (patch) | |
tree | f0f0905e72a20a1ad4d38a65c1a4e329a1cdcfb9 /net | |
parent | 8e6f45f54f32b38f67960fad65f10f9ec7abdcca (diff) | |
download | barebox-b7fc51bd793467d72695e0b18151e05a551ed152.tar.gz barebox-b7fc51bd793467d72695e0b18151e05a551ed152.tar.xz |
complete: add eth interface complete support
use it on ethact
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/eth.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -23,6 +23,7 @@ #include <common.h> #include <command.h> +#include <complete.h> #include <driver.h> #include <init.h> #include <net.h> @@ -109,6 +110,26 @@ struct eth_device *eth_get_byname(char *ethname) return NULL; } +#ifdef CONFIG_AUTO_COMPLETE +int eth_complete(struct string_list *sl, char *instr) +{ + struct eth_device *edev; + const char *devname; + int len; + + len = strlen(instr); + + list_for_each_entry(edev, &netdev_list, list) { + devname = dev_name(&edev->dev); + if (strncmp(instr, devname, len)) + continue; + + string_list_add_asprintf(sl, "%s ", devname); + } + return COMPLETE_CONTNINUE; +} +#endif + int eth_send(void *packet, int length) { int ret; |