summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-05-01 21:41:59 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-05-01 21:41:59 +0200
commite4e3fbd22bca38f10f1cd7a3f5eb75e0b265dcaa (patch)
treefc713ed2e9b4ed774bc4dda9521dcb7ff867e2dd /net
parent8ca42643d4a3a15d4802f93d1433e640b846df04 (diff)
parent9492976bc88a9fe4633202681fcdc24ce1dab636 (diff)
downloadbarebox-e4e3fbd22bca38f10f1cd7a3f5eb75e0b265dcaa.tar.gz
barebox-e4e3fbd22bca38f10f1cd7a3f5eb75e0b265dcaa.tar.xz
Merge tag 'complete_update_support' of git://git.jcrosoft.org/barebox into next
improve complete support The following patch serie improve the complete support by adding a complete framework to allow commands complete support. The add also car complete support for eval and setting and executable file support This also include an update of the stringlist API to support asprintf API
Diffstat (limited to 'net')
-rw-r--r--net/dhcp.c2
-rw-r--r--net/eth.c21
2 files changed, 23 insertions, 0 deletions
diff --git a/net/dhcp.c b/net/dhcp.c
index bd3ac1a297..79efa3e30e 100644
--- a/net/dhcp.c
+++ b/net/dhcp.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
+#include <complete.h>
#include <environment.h>
#include <clock.h>
#include <net.h>
@@ -705,6 +706,7 @@ BAREBOX_CMD_START(dhcp)
.cmd = do_dhcp,
.usage = "invoke dhcp client to obtain ip/boot params",
BAREBOX_CMD_HELP(cmd_dhcp_help)
+ BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END
BAREBOX_MAGICVAR(bootfile, "bootfile returned from DHCP request");
diff --git a/net/eth.c b/net/eth.c
index 130805b7aa..4ea9fb0f4e 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -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;