diff --git a/conman.c b/conman.c index 3d0d2050..50febe35 100644 --- a/conman.c +++ b/conman.c @@ -73,6 +73,7 @@ #include "statusfile.h" #include "sicshipadaba.h" #include "protocol.h" +#include "sicsvar.h" /* #define UUDEB 1 define UUDEB , for buffer writing for checking encoding */ @@ -107,6 +108,24 @@ struct SCStore { long macroStack; commandContext cc; }; + +/* + * This will return the value of a SICS int variable called "sicsdebug" + * If sicsdebug is not defined it will return 1 + * TODO Maybe define debugging levels. + * + * return 0=debug off, 1=debug on or sicsdebug not defined. + */ +int sicsdebug() { + pSicsVariable debug; + + debug = FindVariable(pServ->pSics, "sicsdebug"); + if (debug) { + return debug->iVal; + } else { + return 1; + } +} /*===========================================================================*/ static char *ConName(long ident) { @@ -765,7 +784,7 @@ int SCNormalWrite(SConnection * self, char *buffer, int iOut) } /* log it for any case */ - if (!(iOut == eInternal + if ( (sicsdebug() || !SCinMacro(self)) && !(iOut == eInternal || (buffer[0] == 'O' && buffer[1] == 'K' && (buffer[2] == '\0' || buffer[2] == '\r' || buffer[2] == '\n')))) SICSLogWrite(buffer, iOut); diff --git a/site_ansto/instrument/server_config.tcl b/site_ansto/instrument/server_config.tcl index afc44f30..523e2c98 100644 --- a/site_ansto/instrument/server_config.tcl +++ b/site_ansto/instrument/server_config.tcl @@ -3,6 +3,9 @@ # Author: Ferdi Franceschini (ffr@ansto.gov.au) #set sicsroot /usr/local/sics +VarMake sicsdebug Int Mugger +sicsdebug 0 + VarMake opal_simulation Text internal opal_simulation true