summaryrefslogtreecommitdiffstats
path: root/common/complete.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-10-07 09:06:37 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-10-07 09:09:01 +0200
commite4a45c096136deaf56a200054c46f474250cc89c (patch)
tree9433fb5eb7e5da899580a6897b8b2c1a9abce021 /common/complete.c
parentf5d77d80f569b0c2f8e7aec39f61ebc66d20b4ba (diff)
downloadbarebox-e4a45c096136deaf56a200054c46f474250cc89c.tar.gz
barebox-e4a45c096136deaf56a200054c46f474250cc89c.tar.xz
completion: Fix completion for devices with a dot in the name
Devices can have a dot in the name, so do not expect the full device name before the first dot. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/complete.c')
-rw-r--r--common/complete.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/common/complete.c b/common/complete.c
index aee21ea183..2dab7d1dde 100644
--- a/common/complete.c
+++ b/common/complete.c
@@ -279,7 +279,7 @@ static int env_param_complete(struct string_list *sl, char *instr, int eval)
struct env_context *c;
char *instr_param;
int len;
- char end = '=';
+ char end = '=', *pos, *dot;
char *begin = "";
if (!instr)
@@ -290,7 +290,6 @@ static int env_param_complete(struct string_list *sl, char *instr, int eval)
end = ' ';
}
- instr_param = strchr(instr, '.');
len = strlen(instr);
c = get_current_context();
@@ -312,20 +311,21 @@ static int env_param_complete(struct string_list *sl, char *instr, int eval)
c = c->parent;
}
- if (instr_param) {
+ pos = instr;
+ while ((dot = strchr(pos, '.'))) {
char *devname;
- len = (instr_param - instr);
-
- devname = xstrndup(instr, len);
+ devname = xstrndup(instr, dot - instr);
instr_param++;
dev = get_device_by_name(devname);
free(devname);
+
if (dev)
- device_param_complete(dev, sl, instr_param, eval);
- return 0;
+ device_param_complete(dev, sl, dot + 1, eval);
+
+ pos = dot + 1;
}
len = strlen(instr);