7 extern int injectfailures;
8 extern float failurechance;
10 extern int injectinstructionfailures;
11 extern int failurecount;
12 extern float instfailurechance;
13 extern int numfailures;
15 extern char ** environ;
17 void processOptions() {
20 for(i=0;environ[i]!=0;i++) {
21 if (strncmp(environ[i],"BRISTLECONE=",12)==0) {
22 options=environ[i]+12;
27 while(options!=NULL) {
28 if (strncmp(options,"-injectfailures",sizeof("-injectfailures")-1)==0) {
29 options=strchr(options,' ');
30 if (options!=NULL) options++;
33 sscanf(options, "%f", &failurechance);
35 printf("Injecting errors with chance=%f\n",failurechance);
36 options=strchr(options,' ');
37 if (options!=NULL) options++;
38 } else if (strncmp(options,"-injectinstructionfailures",sizeof("-injectinstructionfailures")-1)==0) {
39 options=strchr(options,' ');
40 if (options!=NULL) options++;
43 sscanf(options, "%d", &failurecount);
44 options=strchr(options,' ');
45 if (options!=NULL) options++;
49 sscanf(options, "%f", &instfailurechance);
50 options=strchr(options,' ');
51 if (options!=NULL) options++;
55 sscanf(options, "%d", &numfailures);
56 options=strchr(options,' ');
57 if (options!=NULL) options++;
59 instaccum=failurecount;
60 instructioncount=failurecount;
61 injectinstructionfailures=1;
62 printf("Number of failures=%d\n",numfailures);
63 printf("Injecting errors with count=%d\n",failurecount);
64 printf("Injecting errors with chance=%f\n",instfailurechance);
65 } else if (strncmp(options, "-debugtask",sizeof("-debugtask")-1)==0) {
66 options=strchr(options,' ');
67 if (options!=NULL) options++;
69 printf("Debug task option on.\n");
70 } else if (strncmp(options, "-initializerandom", sizeof("-initializerandom")-1)==0) {
71 options=strchr(options,' ');
72 if (options!=NULL) options++;
73 printf("Initializing random number generator.\n");