diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index cd427fc85..4b3ecc997 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -17,6 +17,11 @@ should also be read to understand what has changed since earlier releases. +### Glob pattern allowed in `var` command + +When used with one argument, the `var` command can be used with a glob pattern +for printing matching variables. + ### Fix for input links marked "special" The calcout record (and a number of synApps record types) marks its input diff --git a/modules/libcom/src/iocsh/iocsh.cpp b/modules/libcom/src/iocsh/iocsh.cpp index 474436c72..753dd2c23 100644 --- a/modules/libcom/src/iocsh/iocsh.cpp +++ b/modules/libcom/src/iocsh/iocsh.cpp @@ -1130,6 +1130,16 @@ static void varCallFunc(const iocshArgBuf *args) for (v = iocshVariableHead ; v != NULL ; v = v->next) varHandler(v->pVarDef, args[1].sval); } + else if(args[1].sval == NULL) { + int found = 0; + for (v = iocshVariableHead ; v != NULL ; v = v->next) + if (epicsStrGlobMatch(v->pVarDef->name, args[0].sval) != 0) { + varHandler(v->pVarDef, NULL); + found = 1; + } + if (!found) + fprintf(epicsGetStderr(), "No var matching %s found.\n", args[0].sval); + } else { v = (iocshVariable *)registryFind(iocshVarID, args[0].sval); if (v == NULL) {