libCom: Added echo command to iocsh
This commit is contained in:
@@ -15,6 +15,13 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.</p>
|
||||
<h2 align="center">Changes between 3.15.0.1 and 3.15.0.2</h2>
|
||||
<!-- Insert new items immediately below here ... -->
|
||||
|
||||
<h3>Added echo command to iocsh</h3>
|
||||
|
||||
<p>The single argument string may contain escaped characters, which will be
|
||||
translated to their raw form before being printed (enclose the string in quotes
|
||||
to avoid double-translation). A newline is always appended to the output, and
|
||||
output stream redirection is supported.</p>
|
||||
|
||||
<h3>Added macro EPICS_UNUSED to compilerDependencies.h</h3>
|
||||
|
||||
<p>To prevent the compiler from warning about a known-unused variable, mark it
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define epicsExportSharedSymbols
|
||||
#include "iocsh.h"
|
||||
#include "epicsStdioRedirect.h"
|
||||
#include "epicsString.h"
|
||||
#include "epicsTime.h"
|
||||
#include "epicsThread.h"
|
||||
#include "epicsMutex.h"
|
||||
@@ -50,6 +51,17 @@ static void dateCallFunc (const iocshArgBuf *args)
|
||||
date(args[0].sval);
|
||||
}
|
||||
|
||||
/* echo */
|
||||
static const iocshArg echoArg0 = { "string",iocshArgString};
|
||||
static const iocshArg * const echoArgs[1] = {&echoArg0};
|
||||
static const iocshFuncDef echoFuncDef = {"echo",1,echoArgs};
|
||||
static void echoCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
char *str = args[0].sval;
|
||||
|
||||
dbTranslateEscape(str, str); /* in-place is safe */
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
/* chdir */
|
||||
static const iocshArg chdirArg0 = { "directory name",iocshArgString};
|
||||
@@ -348,6 +360,7 @@ static void installLastResortEventProviderCallFunc(const iocshArgBuf *args)
|
||||
void epicsShareAPI libComRegister(void)
|
||||
{
|
||||
iocshRegister(&dateFuncDef, dateCallFunc);
|
||||
iocshRegister(&echoFuncDef, echoCallFunc);
|
||||
iocshRegister(&chdirFuncDef, chdirCallFunc);
|
||||
iocshRegister(&pwdFuncDef, pwdCallFunc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user