allow specification of the input file name on the command line
[lttv.git] / trunk / masters-pmf / java_speed_test / c / main.c
index 08baaf62b78b76cca7f6da8c5a2318fb135735c4..de666de84537bd2669f2cad5424560e77e4c4482 100644 (file)
@@ -15,11 +15,26 @@ int main(int argc, char **argv)
        int result;
        FILE *fp;
        int print = 0;
+       int i;
+       char *filename = NULL;
+
+       if(argc > 1) {
+               for(i=1; i<argc; i++) {
+                       if(!strcmp(argv[i], "-p")) {
+                               print = 1;
+                       }
+                       else {
+                               filename = argv[i];
+                       }
+               }
+       }
 
-       if(argc >= 2 && !strcmp(argv[1], "-p"))
-               print = 1;
+       if(filename == NULL) {
+               fprintf(stderr, "No trace file specified\n");
+               return 1;
+       }
 
-       fp = fopen("../trace.dat", "r");
+       fp = fopen(filename, "r");
        if(fp == NULL) {
                perror("fopen");
                return 1;
This page took 0.023815 seconds and 4 git commands to generate.