- Fixed a bug with hlist -val
This commit is contained in:
19
alias.c
19
alias.c
@ -212,3 +212,22 @@
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*-------------------------------------------------------------------------------*/
|
||||||
|
int LocateAliasAction(SConnection *pCon, SicsInterp *pSics,
|
||||||
|
void *pData, int argc, char *argv[]){
|
||||||
|
char *aliases = NULL;
|
||||||
|
|
||||||
|
if(argc < 2){
|
||||||
|
SCWrite(pCon,"ERROR: missing argument aliasname for locating aliases",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
strtolower(argv[1]);
|
||||||
|
aliases = FindAliases(pSics,argv[1]);
|
||||||
|
if(aliases == NULL){
|
||||||
|
SCWrite(pCon,"NONE", eValue);
|
||||||
|
} else {
|
||||||
|
SCPrintf(pCon,eValue,"%s = %s",argv[1], aliases);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
2
alias.h
2
alias.h
@ -16,5 +16,7 @@
|
|||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
int MakeAlias(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int MakeAlias(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
int LocateAliasAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
5
exeman.c
5
exeman.c
@ -1068,11 +1068,14 @@ static int printBuffer(pExeMan self, SConnection *pCon,
|
|||||||
DeleteDynString(filePath);
|
DeleteDynString(filePath);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
DeleteDynString(filePath);
|
||||||
|
SCStartBuffering(pCon);
|
||||||
while(fgets(pLine,511,fd) != NULL){
|
while(fgets(pLine,511,fd) != NULL){
|
||||||
SCWrite(pCon,pLine,eValue);
|
SCWrite(pCon,pLine,eValue);
|
||||||
}
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
DeleteDynString(filePath);
|
filePath = SCEndBuffering(pCon);
|
||||||
|
SCWrite(pCon,GetCharArray(filePath),eValue);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*========================== run stack ===============================*/
|
/*========================== run stack ===============================*/
|
||||||
|
@ -324,7 +324,7 @@ int SetHipadabaPar(pHdb node, hdbValue v, void *callData);
|
|||||||
*/
|
*/
|
||||||
int UpdateHipadabaPar(pHdb node, hdbValue v, void *callData);
|
int UpdateHipadabaPar(pHdb node, hdbValue v, void *callData);
|
||||||
/**
|
/**
|
||||||
* notify any update listeners that this node has been internally modidifed.
|
* notify any update listeners that this node has been internally modifed.
|
||||||
* @param node The node modified
|
* @param node The node modified
|
||||||
* @param callData Addtional data for the callback
|
* @param callData Addtional data for the callback
|
||||||
* @return 1 on success, 0 on failure
|
* @return 1 on success, 0 on failure
|
||||||
|
1
ofac.c
1
ofac.c
@ -247,6 +247,7 @@
|
|||||||
AddCommand(pInter,"commandlog",CommandLog,CommandLogClose,NULL);
|
AddCommand(pInter,"commandlog",CommandLog,CommandLogClose,NULL);
|
||||||
AddCommand(pInter,"udpquieck",QuieckAction,KillQuieck,NULL);
|
AddCommand(pInter,"udpquieck",QuieckAction,KillQuieck,NULL);
|
||||||
AddCommand(pInter,"alias",MakeAlias,NULL,NULL);
|
AddCommand(pInter,"alias",MakeAlias,NULL,NULL);
|
||||||
|
AddCommand(pInter,"findalias",LocateAliasAction,NULL,NULL);
|
||||||
AddCommand(pInter,"sicscron",MakeCron,NULL,NULL);
|
AddCommand(pInter,"sicscron",MakeCron,NULL,NULL);
|
||||||
AddCommand(pInter,"dolater",MakeCron,NULL,NULL);
|
AddCommand(pInter,"dolater",MakeCron,NULL,NULL);
|
||||||
AddCommand(pInter,"sicsdatafactory",SICSDataFactory,NULL,NULL);
|
AddCommand(pInter,"sicsdatafactory",SICSDataFactory,NULL,NULL);
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
*
|
*
|
||||||
* Added property functions, Mark Koennecke, January 2007
|
* Added property functions, Mark Koennecke, January 2007
|
||||||
*
|
*
|
||||||
|
* Added hmatchprop function. Mark Koennecke, February 2008
|
||||||
|
*
|
||||||
* TODO: separate this into two modules: sicshipadaba proper and sicshipadabaint for the
|
* TODO: separate this into two modules: sicshipadaba proper and sicshipadabaint for the
|
||||||
* interpreter interface.
|
* interpreter interface.
|
||||||
*/
|
*/
|
||||||
@ -2353,7 +2355,7 @@ static int ListHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strchr(argv[1],'-') != NULL){
|
if(argv[1][0] == '-'){
|
||||||
pathArg = 2;
|
pathArg = 2;
|
||||||
if(argc < 3){
|
if(argc < 3){
|
||||||
SCWrite(pCon,"ERROR: need path to node to print",eError);
|
SCWrite(pCon,"ERROR: need path to node to print",eError);
|
||||||
@ -2789,6 +2791,61 @@ static int ListSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData
|
|||||||
DeleteDynString(data);
|
DeleteDynString(data);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static pHdb matchHdbProp(pHdb root, char *propname, char *buffer){
|
||||||
|
char value[1024];
|
||||||
|
pHdb current = NULL, search;
|
||||||
|
|
||||||
|
memset(value,0,1024);
|
||||||
|
if(GetHdbProperty(root,propname,value,1023) == 1){
|
||||||
|
if(strstr(buffer,value) != NULL){
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
current = root->child;
|
||||||
|
while(current != NULL){
|
||||||
|
search = matchHdbProp(current,propname,buffer);
|
||||||
|
if(search != NULL){
|
||||||
|
return search;
|
||||||
|
}
|
||||||
|
current = current->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int MatchHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]){
|
||||||
|
pHdb root = NULL;
|
||||||
|
pHdb foundNode = NULL;
|
||||||
|
char buffer[1024], *path = NULL;
|
||||||
|
|
||||||
|
if(argc < 4){
|
||||||
|
SCWrite(pCon,"ERROR: need root, property name and target string for search",
|
||||||
|
eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memset(buffer,0,1024);
|
||||||
|
Arg2Text(argc-3,&argv[3],buffer,1023);
|
||||||
|
root = GetHipadabaNode(GetHipadabaRoot(), argv[1]);
|
||||||
|
if(root == NULL){
|
||||||
|
SCWrite(pCon,"ERROR: start node for search not found",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
strtolower(argv[2]);
|
||||||
|
strtolower(buffer);
|
||||||
|
foundNode = matchHdbProp(root,argv[2],buffer);
|
||||||
|
|
||||||
|
if(foundNode == NULL){
|
||||||
|
SCWrite(pCon,"NONE", eValue);
|
||||||
|
} else {
|
||||||
|
path = GetHipadabaPath(foundNode);
|
||||||
|
SCWrite(pCon,path,eValue);
|
||||||
|
free(path);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
/*======================= Factory Functions =================================*/
|
/*======================= Factory Functions =================================*/
|
||||||
void killSICSHipadaba(){
|
void killSICSHipadaba(){
|
||||||
if(root != NULL){
|
if(root != NULL){
|
||||||
@ -2820,7 +2877,8 @@ int InstallSICSHipadaba(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|||||||
AddCommand(pSics,"hcommand",SicsCommandNode, NULL, NULL);
|
AddCommand(pSics,"hcommand",SicsCommandNode, NULL, NULL);
|
||||||
AddCommand(pSics,"hsetprop",SetSICSHdbProperty, NULL, NULL);
|
AddCommand(pSics,"hsetprop",SetSICSHdbProperty, NULL, NULL);
|
||||||
AddCommand(pSics,"hgetprop",GetSICSHdbProperty, NULL, NULL);
|
AddCommand(pSics,"hgetprop",GetSICSHdbProperty, NULL, NULL);
|
||||||
AddCommand(pSics,"hgetpropval",GetSICSHdbPropertyVal, NULL, NULL);
|
AddCommand(pSics,"hgetprop",GetSICSHdbProperty, NULL, NULL);
|
||||||
|
AddCommand(pSics,"hmatchprop",MatchHdbProperty, NULL, NULL);
|
||||||
AddCommand(pSics,"hlistprop",ListSICSHdbProperty, NULL, NULL);
|
AddCommand(pSics,"hlistprop",ListSICSHdbProperty, NULL, NULL);
|
||||||
|
|
||||||
InstallSICSPoll(pCon,pSics,pData,argc,argv);
|
InstallSICSPoll(pCon,pSics,pData,argc,argv);
|
||||||
|
Reference in New Issue
Block a user