added sicsdescriptor command
This commit is contained in:
39
script.c
39
script.c
@ -522,3 +522,42 @@
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*----------------------- get object descriptor name -------------------------------
|
||||||
|
get the name of the object descriptor
|
||||||
|
*/
|
||||||
|
|
||||||
|
int SICSDescriptor(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[])
|
||||||
|
{
|
||||||
|
CommandList *pCom = NULL;
|
||||||
|
Dummy *pDum = NULL;
|
||||||
|
char pBueffel[132];
|
||||||
|
|
||||||
|
|
||||||
|
assert(pCon);
|
||||||
|
assert(pSics);
|
||||||
|
|
||||||
|
/* is there a parameter anyway */
|
||||||
|
if(argc < 2)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,"ERROR: no object specified!",eError);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
pCom = FindCommand(pSics,argv[1]);
|
||||||
|
if(pCom)
|
||||||
|
{
|
||||||
|
pDum = (Dummy *)pCom->pData;
|
||||||
|
if(pDum)
|
||||||
|
{
|
||||||
|
SCWrite(pCon,pDum->pDescriptor->name,eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
SCWrite(pCon,"empty",eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SCWrite(pCon,"notfound",eValue);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
3
script.h
3
script.h
@ -45,6 +45,9 @@
|
|||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
int SicsPrompt(SConnection *pCon, SicsInterp *pSics, void *pData,
|
int SicsPrompt(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
int argc, char *argv[]);
|
int argc, char *argv[]);
|
||||||
|
/*----------------------------------------------------------------------*/
|
||||||
|
int SICSDescriptor(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||||
|
int argc, char *argv[]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user