Merge branch 'develop' into rhel7
This commit is contained in:
1
ofac.c
1
ofac.c
@ -127,6 +127,7 @@ static void InitIniCommands(SicsInterp * pInter)
|
||||
PCMD("wait", UserWait);
|
||||
PCMD("yield", UserYield);
|
||||
PCMD("checksum", CheckSum);
|
||||
PCMD("loguserinfo", LogUserInfoWrapper);
|
||||
|
||||
/* startup commands in alphabetic order */
|
||||
SCMD("allowexec", AllowExec);
|
||||
|
@ -2065,7 +2065,7 @@ pDynString formatValue(hdbValue v, pHdb node)
|
||||
DynStringCopy(result, number);
|
||||
break;
|
||||
case HIPFLOAT:
|
||||
if (GetHdbProperty(node, "fmt", format, sizeof format - 1)) {
|
||||
if (node != NULL && GetHdbProperty(node, "fmt", format, sizeof format - 1)) {
|
||||
snprintf(number, 30, format, v.v.doubleValue);
|
||||
} else {
|
||||
snprintf(number, 30, "%.6g", v.v.doubleValue);
|
||||
@ -2084,7 +2084,7 @@ pDynString formatValue(hdbValue v, pHdb node)
|
||||
break;
|
||||
case HIPFLOATAR:
|
||||
case HIPFLOATVARAR:
|
||||
if (GetHdbProperty(node, "fmt", format + 1, sizeof format - 2)) {
|
||||
if (node != NULL && GetHdbProperty(node, "fmt", format + 1, sizeof format - 2)) {
|
||||
format[0] = ' ';
|
||||
} else {
|
||||
strcpy(format, " %.6g");
|
||||
|
33
sicsutil.c
33
sicsutil.c
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* Some general functions for SICS. Most part is moved from ofac.c
|
||||
*
|
||||
* copyright: see file COPYRIGHT
|
||||
@ -15,6 +15,7 @@
|
||||
#include "sicsdata.h"
|
||||
#include "SCinter.h"
|
||||
#include "sicshipadaba.h"
|
||||
#include "sicsget.h"
|
||||
|
||||
static char *aCode[] = {
|
||||
"internal",
|
||||
@ -140,4 +141,34 @@ int CheckSum(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
SCWrite(pCon,"ERROR: object type not recognized", eError);
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
void LogUserInfo(void *pData)
|
||||
{
|
||||
hdbValue user, proposal;
|
||||
SConnection *pCon = (SConnection *)pData;
|
||||
pDynString data;
|
||||
|
||||
if(pData == NULL){
|
||||
return;
|
||||
}
|
||||
user = MakeHdbText(strdup("Martina Notconfigured"));
|
||||
proposal = MakeHdbText(strdup("Unproposed"));
|
||||
|
||||
sget("user",&user);
|
||||
sget("proposalid",&proposal);
|
||||
data = formatValue(proposal,NULL);
|
||||
SCPrintf(pCon,eLog,"WARNING: Saving data for %s, proposal %s", user.v.text,
|
||||
GetCharArray(data));
|
||||
DeleteDynString(data);
|
||||
ReleaseHdbValue(&user);
|
||||
ReleaseHdbValue(&proposal);
|
||||
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int LogUserInfoWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
|
||||
int argc, char *argv[])
|
||||
{
|
||||
LogUserInfo(pCon);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -24,3 +24,4 @@ unsigned short fletcher16( char *data, size_t len);
|
||||
|
||||
|
||||
|
||||
void LogUserInfo(void *pCon);
|
||||
|
Reference in New Issue
Block a user