static long asInitCommon(void) { long status; int asWasActive = asActive; int wasFirstTime = firstTime; static epicsThreadOnceId asInitCommonOnceFlag = EPICS_THREAD_ONCE_INIT; epicsThreadOnce(&asInitCommonOnceFlag,asInitCommonOnce,(void *)&firstTime); if(wasFirstTime) { if(!pacf) return(0); /*access security will NEVER be turned on*/ } else { if(!asActive) { printf("Access security is NOT enabled." " Was asSetFilename specified before iocInit?\n"); return(S_asLib_asNotActive); } if(pacf) { asCaStop(); } else { /*Just leave everything as is */ return(S_asLib_badConfig); } } status = asInitFile(pacf,psubstitutions); if(asActive) { if(!asWasActive) { dbSpcAsRegisterCallback(asSpcAsCallback); asDbAddRecords(); } asCaStart(); } return(status); }
int main(int argc,char **argv) { int argn = 1; char *sub = NULL; int subLength = 0; char **pstr; char *psep; int *len; long status = 0; static char *subSep = ","; /* Look for -Smacro=value options */ while (argc>argn && (strncmp(argv[argn], "-S", 2)==0)) { pstr = ⊂ psep = subSep; len = &subLength; if (strlen(argv[argn])==2) { dbCatString(pstr, len, argv[++argn], psep); } else { dbCatString(pstr, len, argv[argn]+2, psep); } argn++; } if (argc == argn) { status = asInitFP(stdin, sub); if(status) errlogPrintf("ascheck: Access Security File failed.\n"); } else if (argc == argn+1) { status = asInitFile(argv[argn], sub); if(status) errlogPrintf("ascheck: Access Security File failed.\n"); } else { printf("usage: ascheck [-Smac=sub ...] [<] file\n"); status = -1; } errlogFlush(); return status; }