Merged 2.4 branch
r2828 | ffr | 2009-11-25 09:56:49 +1100 (Wed, 25 Nov 2009) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
c58ee9fbcb
commit
2ec6505ef8
25
sicslist.c
25
sicslist.c
@@ -161,6 +161,16 @@ static int printObjectData(SConnection *pCon, pDummy obj, char *key){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
static int existsObjectData(SConnection *pCon, pDummy obj, char *key) {
|
||||
char *ptr = NULL;
|
||||
ptr = IFindOption(obj->pDescriptor->pKeys,key);
|
||||
if(ptr != NULL)
|
||||
SCPrintf(pCon, eValue, "%s", "true");
|
||||
else
|
||||
SCPrintf(pCon, eValue, "%s", "false");
|
||||
|
||||
return 1;
|
||||
}
|
||||
/*-----------------------------------------------------------------
|
||||
* this function implements a set on top of a list. This means that
|
||||
* the list is first searched for the occurence of name. name is only
|
||||
@@ -493,6 +503,21 @@ int SicsList(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
}
|
||||
}
|
||||
|
||||
if(strcmp(argv[1],"exists") == 0) {
|
||||
if (argc < 4) {
|
||||
SCWrite(pCon,"ERROR: not enough arguments",eError);
|
||||
return 0;
|
||||
} else {
|
||||
pCom = FindCommand(pSics,argv[2]);
|
||||
if ( pCom == NULL ) {
|
||||
SCWrite(pCon,"ERROR: Object doesn't exist",eError);
|
||||
return 0;
|
||||
} else
|
||||
return existsObjectData(pCon,(pDummy)pCom->pData, argv[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* object properties
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user