X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FRuntime%2Foption.c;h=8fb9cf08f5af794df117077735338b7bd6522258;hb=25d27928c6c81b4776b586c25b72760eac155e93;hp=552f996447fc8c30d11510b7a973f4aba4fd0181;hpb=5d6fb3a488b8e8000e4794d9d77e3f684b7c05b3;p=IRC.git diff --git a/Robust/src/Runtime/option.c b/Robust/src/Runtime/option.c index 552f9964..8fb9cf08 100644 --- a/Robust/src/Runtime/option.c +++ b/Robust/src/Runtime/option.c @@ -3,11 +3,13 @@ #include #include #include "runtime.h" +#include extern char *options; extern int injectfailures; extern float failurechance; extern int debugtask; +extern int errors; extern int injectinstructionfailures; extern int failurecount; extern float instfailurechance; @@ -18,19 +20,19 @@ extern char ** environ; void processOptions() { int i; options=NULL; - for(i=0;environ[i]!=0;i++) { + for(i=0; environ[i]!=0; i++) { if (strncmp(environ[i],"BRISTLECONE=",12)==0) { options=environ[i]+12; break; } } - + while(options!=NULL) { if (strncmp(options,"-injectfailures",sizeof("-injectfailures")-1)==0) { options=strchr(options,' '); if (options!=NULL) options++; if (options==NULL) - break; + break; sscanf(options, "%f", &failurechance); injectfailures=1; printf("Injecting errors with chance=%f\n",failurechance); @@ -40,18 +42,18 @@ void processOptions() { options=strchr(options,' '); if (options!=NULL) options++; if (options==NULL) - break; + break; sscanf(options, "%d", &failurecount); options=strchr(options,' '); if (options!=NULL) options++; if (options==NULL) - break; + break; sscanf(options, "%f", &instfailurechance); options=strchr(options,' '); if (options!=NULL) options++; if (options==NULL) - break; + break; sscanf(options, "%d", &numfailures); options=strchr(options,' '); @@ -68,6 +70,11 @@ void processOptions() { if (options!=NULL) options++; debugtask=1; printf("Debug task option on.\n"); + } else if (strncmp(options, "-errors",sizeof("-errors")-1)==0) { + options=strchr(options,' '); + if (options!=NULL) options++; + errors=1; + printf("Errors on.\n"); } else if (strncmp(options, "-initializerandom", sizeof("-initializerandom")-1)==0) { options=strchr(options,' '); if (options!=NULL) options++;