Added nagging output about a user name when saving scan data files

This commit is contained in:
2017-02-24 11:11:42 +01:00
parent 2673bb3b6d
commit e8ae653095
4 changed files with 31 additions and 1 deletions

1
ofac.c
View File

@ -127,6 +127,7 @@ static void InitIniCommands(SicsInterp * pInter)
PCMD("wait", UserWait); PCMD("wait", UserWait);
PCMD("yield", UserYield); PCMD("yield", UserYield);
PCMD("checksum", CheckSum); PCMD("checksum", CheckSum);
PCMD("loguserinfo", LogUserInfoWrapper);
/* startup commands in alphabetic order */ /* startup commands in alphabetic order */
SCMD("allowexec", AllowExec); SCMD("allowexec", AllowExec);

View File

@ -1,4 +1,4 @@
/** /**
* Some general functions for SICS. Most part is moved from ofac.c * Some general functions for SICS. Most part is moved from ofac.c
* *
* copyright: see file COPYRIGHT * copyright: see file COPYRIGHT
@ -15,6 +15,7 @@
#include "sicsdata.h" #include "sicsdata.h"
#include "SCinter.h" #include "SCinter.h"
#include "sicshipadaba.h" #include "sicshipadaba.h"
#include "sicsget.h"
static char *aCode[] = { static char *aCode[] = {
"internal", "internal",
@ -140,4 +141,30 @@ int CheckSum(SConnection * pCon, SicsInterp * pSics, void *pData,
SCWrite(pCon,"ERROR: object type not recognized", eError); SCWrite(pCon,"ERROR: object type not recognized", eError);
return 0; return 0;
} }
/*-----------------------------------------------------------------------------*/
void LogUserInfo(void *data)
{
hdbValue user, proposal;
SConnection *pCon = (SConnection *)data;
if(data == NULL){
return;
}
user = MakeHdbText(strdup("Martina Notconfigured"));
proposal = MakeHdbText(strdup("Unproposed"));
sget("user",&user);
sget("proposalid",&proposal);
SCPrintf(pCon,eLog,"WARNING: Saving data for %s, proposal %s", user.v.text, proposal.v.text);
ReleaseHdbValue(&user);
ReleaseHdbValue(&proposal);
}
/*--------------------------------------------------------------------------*/
int LogUserInfoWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
int argc, char *argv[])
{
LogUserInfo(pCon);
return 1;
}

View File

@ -24,3 +24,4 @@ unsigned short fletcher16( char *data, size_t len);
void LogUserInfo(void *pCon);

View File

@ -579,6 +579,7 @@ int prepareDataFile(pScanData self)
} }
snprintf(pBueffel, 511, "Writing data file: %s ...", pPtr); snprintf(pBueffel, 511, "Writing data file: %s ...", pPtr);
SCWrite(self->pCon, pBueffel, eLog); SCWrite(self->pCon, pBueffel, eLog);
LogUserInfo(self->pCon);
strcpy(self->pFile, pPtr); strcpy(self->pFile, pPtr);
free(pPtr); free(pPtr);
return 1; return 1;