- Introduced a command history log for statistical and
syntax checking input purposes - Rectified an error message in fourmess.c - HMcontrol did not check for the HM to stop before returning. This caused weird data files at AMOR as the data had not yet been downloaded from the HM. - Fixed an issue about parameters in multicounter - Temporary fix in nxscript.c to always read the Hm from the HM and not a buffer. This is prior to rethinking caching strategies for old style HM's. - Synchronize now copies fixed motors correctly. This used to cause irritation with users. This now requires a script syncdrive to exist in the sync server which takes care of handling the fixed flag when this is desired. - Added initify to sicsdata in order to copy large value timebins over properly at AMOR SKIPPED: psi/amorstat.c psi/make_gen psi/makefile_linux psi/polterwrite.c psi/sinq.c psi/sinqhttp.c psi/sinqhttpprot.c psi/sps.c psi/tdchm.c
This commit is contained in:
43
commandlog.c
43
commandlog.c
@@ -521,3 +521,46 @@ void CommandLogInit(void)
|
||||
{
|
||||
AddCommand(pServ->pSics, "commandlog", CommandLog, CommandLogClose, NULL);
|
||||
}
|
||||
/*---------------------- History -----------------------------------------*/
|
||||
static FILE *comHistory = NULL;
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static int openHistoryLog()
|
||||
{
|
||||
char *fileName = NULL;
|
||||
char fileBuffer[1024];
|
||||
time_t iDate;
|
||||
struct tm *psTime;
|
||||
|
||||
|
||||
if (comHistory == NULL) {
|
||||
fileName = IFindOption(pSICSOptions, "historylog");
|
||||
if (fileName != NULL) {
|
||||
strlcpy(fileBuffer, fileName,1024);
|
||||
} else {
|
||||
iDate = time(NULL);
|
||||
psTime = localtime(&iDate);
|
||||
fileBuffer[0] = '\0';
|
||||
fileName = getenv("HOME");
|
||||
if (fileName != NULL) {
|
||||
snprintf(fileBuffer, 1023, "%s/log/comhistory%4.4d.log",
|
||||
fileName, psTime->tm_year + 1900);
|
||||
}
|
||||
}
|
||||
comHistory = fopen(fileBuffer, "a+");
|
||||
}
|
||||
if (comHistory == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------*/
|
||||
void WriteCommandHistory(char *txt)
|
||||
{
|
||||
if(comHistory == NULL){
|
||||
openHistoryLog();
|
||||
}
|
||||
if(comHistory != NULL){
|
||||
fprintf(comHistory,"%s\n", txt);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user