Implement the command "sics_revision" to get the SVN revision into the SICServer executable

r3734 | dcl | 2012-09-14 17:18:11 +1000 (Fri, 14 Sep 2012) | 1 line
This commit is contained in:
Douglas Clowes
2012-09-14 17:18:11 +10:00
parent 62d894b9e7
commit 6b482b29ec
2 changed files with 16 additions and 1 deletions

View File

@@ -93,9 +93,12 @@ ifeq (,$(LIB_HTTP))
$(warning LIB_HTTP not found)
endif
REVISION = $(shell svn info | grep "Revision:" | cut -d ' ' -f 2)
$(shell touch site_ansto.c)
$(info Revision text is "${REVISION}")
#
DEBUGFLAGS = -Wall -Wextra -Wno-unused -Wno-comment -Wno-switch
CFLAGS = -g $(INCFLAGS) $(DEBUGFLAGS) -std=gnu99
CFLAGS = -g $(INCFLAGS) $(DEBUGFLAGS) -std=gnu99 -DREVISION='"R${REVISION}"'
SRC = ./../..
SITENAME = _ansto

View File

@@ -69,6 +69,17 @@ extern void AddTCPMBProtocol ();
extern void AddLFGenProtocol();
extern int ANSTO_MakeHistMemory(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]);
int SICS_Revision(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[])
{
char line[132];
#ifdef REVISION
snprintf(line, 132, "SICS_Revision = %s", REVISION);
#else
snprintf(line, 132, "SICS_Revision = UNKNOWN");
#endif
SCWrite(pCon, line, eValue);
return OKOK;
};
void SiteInit(void) {
int NetWatchInit(void);
@@ -114,6 +125,7 @@ static void AddCommands(SicsInterp *pInter)
AddCommand(pInter,"MakeLSSMonitor",LSSFactory,NULL,NULL);
AddCommand(pInter,"MakeActionObject",ActionObjectFactory,NULL,NULL);
AddCommand(pInter,"ANSTO_MakeHM",ANSTO_MakeHistMemory,NULL,NULL);
AddCommand(pInter,"SICS_Revision",SICS_Revision,NULL,NULL);
}
/*---------------------------------------------------------------------*/
static void RemoveCommands(SicsInterp *pSics){