Merge Dirk's FixShellCommands branch into 7.0
This commit is contained in:
@@ -755,13 +755,22 @@ long dbBufferSize(short dbr_type, long options, long no_elements)
|
||||
}
|
||||
int dbLoadDatabase(const char *file, const char *path, const char *subs)
|
||||
{
|
||||
if (!file) {
|
||||
printf("Usage: dbLoadDatabase \"file\", \"path\", \"subs\"\n");
|
||||
return -1;
|
||||
}
|
||||
return dbReadDatabase(&pdbbase, file, path, subs);
|
||||
}
|
||||
|
||||
int dbLoadRecords(const char* file, const char* subs)
|
||||
{
|
||||
int status = dbReadDatabase(&pdbbase, file, 0, subs);
|
||||
int status;
|
||||
|
||||
if (!file) {
|
||||
printf("Usage: dbLoadRecords \"file\", \"subs\"\n");
|
||||
return -1;
|
||||
}
|
||||
status = dbReadDatabase(&pdbbase, file, 0, subs);
|
||||
if (!status && dbLoadRecordsHook)
|
||||
dbLoadRecordsHook(file, subs);
|
||||
return status;
|
||||
|
||||
@@ -283,6 +283,10 @@ long dbb(const char *record_name)
|
||||
/*
|
||||
* Convert name to address
|
||||
*/
|
||||
if (!record_name) {
|
||||
printf("Usage: dbb \"record_name\"\n");
|
||||
return -1;
|
||||
}
|
||||
status = dbNameToAddr(record_name, &addr);
|
||||
if (status == S_db_notFound)
|
||||
printf(" BKPT> Record %s not found\n", record_name);
|
||||
@@ -403,6 +407,10 @@ long dbd(const char *record_name)
|
||||
/*
|
||||
* Convert name to address
|
||||
*/
|
||||
if (!record_name) {
|
||||
printf("Usage: dbd \"record_name\"\n");
|
||||
return -1;
|
||||
}
|
||||
status = dbNameToAddr(record_name, &addr);
|
||||
if (status == S_db_notFound)
|
||||
printf(" BKPT> Record %s not found\n", record_name);
|
||||
@@ -846,6 +854,10 @@ long dbap(const char *record_name)
|
||||
/*
|
||||
* Convert name to address
|
||||
*/
|
||||
if (!record_name) {
|
||||
printf("Usage: dbap \"record_name\"\n");
|
||||
return -1;
|
||||
}
|
||||
status = dbNameToAddr(record_name, &addr);
|
||||
if (status == S_db_notFound)
|
||||
printf(" BKPT> Record %s not found\n", record_name);
|
||||
|
||||
@@ -596,9 +596,13 @@ long dbtpn(char *pname, char *pvalue)
|
||||
tpnInfo *ptpnInfo;
|
||||
processNotify *ppn=NULL;
|
||||
|
||||
if (!pname) {
|
||||
printf("Usage: dbtpn \"name\", \"value\"\n");
|
||||
return -1;
|
||||
}
|
||||
chan = dbChannelCreate(pname);
|
||||
if (!chan) {
|
||||
printf("dbtpn: No such channel");
|
||||
printf("dbtpn: No such channel\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,9 @@ dbStateId dbStateFind(const char *name)
|
||||
ELLNODE *node;
|
||||
dbStateId id;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
for (node = ellFirst(&states); node; node = ellNext(node)) {
|
||||
id = CONTAINER(node, dbState, node);
|
||||
if (strcmp(id->name, name) == 0)
|
||||
@@ -49,6 +52,9 @@ dbStateId dbStateCreate(const char *name)
|
||||
{
|
||||
dbStateId id;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
if ((id = dbStateFind(name)))
|
||||
return id;
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@ int gft(const char *pname)
|
||||
short type;
|
||||
int i;
|
||||
|
||||
if (!pname) {
|
||||
printf("Usage: gft \"pv_name\"\n");
|
||||
return -1;
|
||||
}
|
||||
chan = dbChannel_create(pname);
|
||||
if (!chan) {
|
||||
printf("Channel couldn't be created\n");
|
||||
@@ -94,6 +98,10 @@ int pft(const char *pname, const char *pvalue)
|
||||
unsigned char charvalue;
|
||||
double doublevalue;
|
||||
|
||||
if (!pname || !pvalue) {
|
||||
printf("Usage: pft \"pv_name\", \"value\"\n");
|
||||
return -1;
|
||||
}
|
||||
chan = dbChannel_create(pname);
|
||||
if (!chan) {
|
||||
printf("Channel couldn't be created\n");
|
||||
@@ -223,6 +231,10 @@ int tpn(const char *pname, const char *pvalue)
|
||||
tpnInfo *ptpnInfo;
|
||||
processNotify *ppn = NULL;
|
||||
|
||||
if (!pname || !pvalue) {
|
||||
printf("Usage: tpn \"pv_name\", \"value\"\n");
|
||||
return -1;
|
||||
}
|
||||
chan = dbChannel_create(pname);
|
||||
if (!chan) {
|
||||
printf("Channel couldn't be created\n");
|
||||
|
||||
@@ -9,14 +9,19 @@
|
||||
#include "iocsh.h"
|
||||
#include "epicsExport.h"
|
||||
|
||||
IOCSH_STATIC_FUNC void dlload(const char* name)
|
||||
{
|
||||
if (!epicsLoadLibrary(name)) {
|
||||
printf("epicsLoadLibrary failed: %s\n", epicsLoadError());
|
||||
}
|
||||
}
|
||||
|
||||
static const iocshArg dlloadArg0 = { "path/library.so", iocshArgString};
|
||||
static const iocshArg * const dlloadArgs[] = {&dlloadArg0};
|
||||
static const iocshFuncDef dlloadFuncDef = {"dlload", 1, dlloadArgs};
|
||||
static void dlloadCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
if (!epicsLoadLibrary(args[0].sval)) {
|
||||
printf("epicsLoadLibrary failed: %s\n", epicsLoadError());
|
||||
}
|
||||
dlload(args[0].sval);
|
||||
}
|
||||
|
||||
static void dlloadRegistar(void) {
|
||||
|
||||
@@ -14,8 +14,15 @@
|
||||
#define INCiocshH
|
||||
|
||||
#include <stdio.h>
|
||||
#include "compilerDependencies.h"
|
||||
#include "shareLib.h"
|
||||
|
||||
#if defined(vxWorks) || defined(__rtems__)
|
||||
#define IOCSH_STATIC_FUNC
|
||||
#else
|
||||
#define IOCSH_STATIC_FUNC static EPICS_ALWAYS_INLINE
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "libComRegister.h"
|
||||
|
||||
|
||||
/* date */
|
||||
void date(const char *format)
|
||||
{
|
||||
epicsTimeStamp now;
|
||||
@@ -42,7 +43,6 @@ void date(const char *format)
|
||||
puts(nowText);
|
||||
}
|
||||
|
||||
/* date */
|
||||
static const iocshArg dateArg0 = { "format",iocshArgString};
|
||||
static const iocshArg * const dateArgs[] = {&dateArg0};
|
||||
static const iocshFuncDef dateFuncDef = {"date", 1, dateArgs};
|
||||
@@ -52,13 +52,8 @@ static void dateCallFunc (const iocshArgBuf *args)
|
||||
}
|
||||
|
||||
/* 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)
|
||||
IOCSH_STATIC_FUNC void echo(char* str)
|
||||
{
|
||||
char *str = args[0].sval;
|
||||
|
||||
if (str)
|
||||
dbTranslateEscape(str, str); /* in-place is safe */
|
||||
else
|
||||
@@ -66,6 +61,14 @@ static void echoCallFunc(const iocshArgBuf *args)
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
echo(args[0].sval);
|
||||
}
|
||||
|
||||
/* chdir */
|
||||
static const iocshArg chdirArg0 = { "directory name",iocshArgString};
|
||||
static const iocshArg * const chdirArgs[1] = {&chdirArg0};
|
||||
@@ -126,10 +129,15 @@ static void epicsEnvUnsetCallFunc(const iocshArgBuf *args)
|
||||
}
|
||||
|
||||
/* epicsParamShow */
|
||||
IOCSH_STATIC_FUNC void epicsParamShow()
|
||||
{
|
||||
epicsPrtEnvParams ();
|
||||
}
|
||||
|
||||
static const iocshFuncDef epicsParamShowFuncDef = {"epicsParamShow",0,NULL};
|
||||
static void epicsParamShowCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
epicsPrtEnvParams ();
|
||||
epicsParamShow ();
|
||||
}
|
||||
|
||||
/* epicsPrtEnvParams */
|
||||
@@ -163,12 +171,17 @@ static void iocLogInitCallFunc(const iocshArgBuf *args)
|
||||
}
|
||||
|
||||
/* iocLogDisable */
|
||||
IOCSH_STATIC_FUNC void setIocLogDisable(int val)
|
||||
{
|
||||
iocLogDisable = val;
|
||||
}
|
||||
|
||||
static const iocshArg iocLogDisableArg0 = {"(0,1)=>(false,true)",iocshArgInt};
|
||||
static const iocshArg * const iocLogDisableArgs[1] = {&iocLogDisableArg0};
|
||||
static const iocshFuncDef iocLogDisableFuncDef = {"setIocLogDisable",1,iocLogDisableArgs};
|
||||
static void iocLogDisableCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
iocLogDisable = args[0].ival;
|
||||
setIocLogDisable(args[0].ival);
|
||||
}
|
||||
|
||||
/* iocLogShow */
|
||||
@@ -212,12 +225,17 @@ static void errlogInit2CallFunc(const iocshArgBuf *args)
|
||||
}
|
||||
|
||||
/* errlog */
|
||||
IOCSH_STATIC_FUNC void errlog(const char *message)
|
||||
{
|
||||
errlogPrintfNoConsole("%s\n", message);
|
||||
}
|
||||
|
||||
static const iocshArg errlogArg0 = { "message",iocshArgString};
|
||||
static const iocshArg * const errlogArgs[1] = {&errlogArg0};
|
||||
static const iocshFuncDef errlogFuncDef = {"errlog",1,errlogArgs};
|
||||
static void errlogCallFunc(const iocshArgBuf *args)
|
||||
{
|
||||
errlogPrintfNoConsole("%s\n", args[0].sval);
|
||||
errlog(args[0].sval);
|
||||
}
|
||||
|
||||
/* iocLogPrefix */
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
*/
|
||||
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
|
||||
{
|
||||
if (!name) return;
|
||||
iocshEnvClear(name);
|
||||
setenv(name, value, 1);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
|
||||
{
|
||||
char *cp;
|
||||
|
||||
if (!name) return;
|
||||
iocshEnvClear(name);
|
||||
|
||||
cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet");
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
*/
|
||||
epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *value)
|
||||
{
|
||||
if (!name) return;
|
||||
iocshEnvClear(name);
|
||||
setenv(name, value, 1);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,11 @@ epicsShareFunc void epicsShareAPI epicsEnvSet (const char *name, const char *val
|
||||
{
|
||||
char *cp;
|
||||
|
||||
if (!name) {
|
||||
printf ("Usage: epicsEnvSet \"name\", \"value\"\n");
|
||||
return;
|
||||
}
|
||||
|
||||
iocshEnvClear(name);
|
||||
|
||||
cp = mallocMustSucceed (strlen (name) + strlen (value) + 2, "epicsEnvSet");
|
||||
|
||||
Reference in New Issue
Block a user