8 extern int injectfailures;
9 extern float failurechance;
11 extern int injectinstructionfailures;
12 extern int failurecount;
13 extern float instfailurechance;
14 extern int numfailures;
16 extern char ** environ;
18 void processOptions() {
21 for(i=0;environ[i]!=0;i++) {
22 if (strncmp(environ[i],"BRISTLECONE=",12)==0) {
23 options=environ[i]+12;
28 while(options!=NULL) {
29 if (strncmp(options,"-injectfailures",sizeof("-injectfailures")-1)==0) {
30 options=strchr(options,' ');
31 if (options!=NULL) options++;
34 sscanf(options, "%f", &failurechance);
36 printf("Injecting errors with chance=%f\n",failurechance);
37 options=strchr(options,' ');
38 if (options!=NULL) options++;
39 } else if (strncmp(options,"-injectinstructionfailures",sizeof("-injectinstructionfailures")-1)==0) {
40 options=strchr(options,' ');
41 if (options!=NULL) options++;
44 sscanf(options, "%d", &failurecount);
45 options=strchr(options,' ');
46 if (options!=NULL) options++;
50 sscanf(options, "%f", &instfailurechance);
51 options=strchr(options,' ');
52 if (options!=NULL) options++;
56 sscanf(options, "%d", &numfailures);
57 options=strchr(options,' ');
58 if (options!=NULL) options++;
60 instaccum=failurecount;
61 instructioncount=failurecount;
62 injectinstructionfailures=1;
63 printf("Number of failures=%d\n",numfailures);
64 printf("Injecting errors with count=%d\n",failurecount);
65 printf("Injecting errors with chance=%f\n",instfailurechance);
66 } else if (strncmp(options, "-debugtask",sizeof("-debugtask")-1)==0) {
67 options=strchr(options,' ');
68 if (options!=NULL) options++;
70 printf("Debug task option on.\n");
71 } else if (strncmp(options, "-initializerandom", sizeof("-initializerandom")-1)==0) {
72 options=strchr(options,' ');
73 if (options!=NULL) options++;
74 printf("Initializing random number generator.\n");