9 extern int injectfailures;
10 extern float failurechance;
13 extern int injectinstructionfailures;
14 extern int failurecount;
15 extern float instfailurechance;
16 extern int numfailures;
18 extern char ** environ;
20 void processOptions() {
23 for(i=0; environ[i]!=0; i++) {
24 if (strncmp(environ[i],"BRISTLECONE=",12)==0) {
25 options=environ[i]+12;
30 while(options!=NULL) {
31 if (strncmp(options,"-injectfailures",sizeof("-injectfailures")-1)==0) {
32 options=strchr(options,' ');
33 if (options!=NULL) options++;
36 sscanf(options, "%f", &failurechance);
38 printf("Injecting errors with chance=%f\n",failurechance);
39 options=strchr(options,' ');
40 if (options!=NULL) options++;
41 } else if (strncmp(options,"-injectinstructionfailures",sizeof("-injectinstructionfailures")-1)==0) {
42 options=strchr(options,' ');
43 if (options!=NULL) options++;
46 sscanf(options, "%d", &failurecount);
47 options=strchr(options,' ');
48 if (options!=NULL) options++;
52 sscanf(options, "%f", &instfailurechance);
53 options=strchr(options,' ');
54 if (options!=NULL) options++;
58 sscanf(options, "%d", &numfailures);
59 options=strchr(options,' ');
60 if (options!=NULL) options++;
62 instaccum=failurecount;
63 instructioncount=failurecount;
64 injectinstructionfailures=1;
65 printf("Number of failures=%d\n",numfailures);
66 printf("Injecting errors with count=%d\n",failurecount);
67 printf("Injecting errors with chance=%f\n",instfailurechance);
68 } else if (strncmp(options, "-debugtask",sizeof("-debugtask")-1)==0) {
69 options=strchr(options,' ');
70 if (options!=NULL) options++;
72 printf("Debug task option on.\n");
73 } else if (strncmp(options, "-errors",sizeof("-errors")-1)==0) {
74 options=strchr(options,' ');
75 if (options!=NULL) options++;
77 printf("Errors on.\n");
78 } else if (strncmp(options, "-initializerandom", sizeof("-initializerandom")-1)==0) {
79 options=strchr(options,' ');
80 if (options!=NULL) options++;
81 printf("Initializing random number generator.\n");