9 extern int injectfailures;
10 extern float failurechance;
12 extern int injectinstructionfailures;
13 extern int failurecount;
14 extern float instfailurechance;
15 extern int numfailures;
17 extern char ** environ;
19 void processOptions() {
22 for(i=0; environ[i]!=0; i++) {
23 if (strncmp(environ[i],"BRISTLECONE=",12)==0) {
24 options=environ[i]+12;
29 while(options!=NULL) {
30 if (strncmp(options,"-injectfailures",sizeof("-injectfailures")-1)==0) {
31 options=strchr(options,' ');
32 if (options!=NULL) options++;
35 sscanf(options, "%f", &failurechance);
37 printf("Injecting errors with chance=%f\n",failurechance);
38 options=strchr(options,' ');
39 if (options!=NULL) options++;
40 } else if (strncmp(options,"-injectinstructionfailures",sizeof("-injectinstructionfailures")-1)==0) {
41 options=strchr(options,' ');
42 if (options!=NULL) options++;
45 sscanf(options, "%d", &failurecount);
46 options=strchr(options,' ');
47 if (options!=NULL) options++;
51 sscanf(options, "%f", &instfailurechance);
52 options=strchr(options,' ');
53 if (options!=NULL) options++;
57 sscanf(options, "%d", &numfailures);
58 options=strchr(options,' ');
59 if (options!=NULL) options++;
61 instaccum=failurecount;
62 instructioncount=failurecount;
63 injectinstructionfailures=1;
64 printf("Number of failures=%d\n",numfailures);
65 printf("Injecting errors with count=%d\n",failurecount);
66 printf("Injecting errors with chance=%f\n",instfailurechance);
67 } else if (strncmp(options, "-debugtask",sizeof("-debugtask")-1)==0) {
68 options=strchr(options,' ');
69 if (options!=NULL) options++;
71 printf("Debug task option on.\n");
72 } else if (strncmp(options, "-initializerandom", sizeof("-initializerandom")-1)==0) {
73 options=strchr(options,' ');
74 if (options!=NULL) options++;
75 printf("Initializing random number generator.\n");