diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-01-12 15:53:20 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-01-12 15:53:20 +0100 |
commit | 17a478a190d1349b74f34933a6d300a04fdb229d (patch) | |
tree | bdcc360a78838929b59cf05df2b641b2c7d3b592 /src | |
parent | 29e2c841bb9d91fa82e41906e4eb420604e9512f (diff) | |
parent | 8b5adac0d94506927c8fc2efb39812b422e0e330 (diff) | |
download | px4-firmware-17a478a190d1349b74f34933a6d300a04fdb229d.tar.gz px4-firmware-17a478a190d1349b74f34933a6d300a04fdb229d.tar.bz2 px4-firmware-17a478a190d1349b74f34933a6d300a04fdb229d.zip |
Merge branch 'mtd' into mtd_multi
Diffstat (limited to 'src')
-rw-r--r-- | src/systemcmds/param/param.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/systemcmds/param/param.c b/src/systemcmds/param/param.c index 65f291f40..9e5e6f2e6 100644 --- a/src/systemcmds/param/param.c +++ b/src/systemcmds/param/param.c @@ -203,11 +203,38 @@ do_show_print(void *arg, param_t param) int32_t i; float f; const char *search_string = (const char*)arg; + const char *p_name = (const char*)param_name(param); /* print nothing if search string is invalid and not matching */ - if (!(arg == NULL || (!strcmp(search_string, param_name(param))))) { - /* param not found */ - return; + if (!(arg == NULL)) { + + /* start search */ + char *ss = search_string; + char *pp = p_name; + bool mismatch = false; + + /* XXX this comparison is only ok for trailing wildcards */ + while (*ss != '\0' && *pp != '\0') { + + if (*ss == *pp) { + ss++; + pp++; + } else if (*ss == '*') { + if (*(ss + 1) != '\0') { + warnx("* symbol only allowed at end of search string."); + exit(1); + } + + pp++; + } else { + /* param not found */ + return; + } + } + + /* the search string must have been consumed */ + if (!(*ss == '\0' || *ss == '*')) + return; } printf("%c %s: ", |