on the way to path extracting
[mc1516pa.git] / modelchecker / main.c
index 06729b1..b262660 100644 (file)
@@ -28,7 +28,7 @@ void usage(char *prg)
                "\n"
                "Positional arguments:\n"
                "\tFILE  zero or one sokoban screens\n"
-               "\t      when no file is specified stdin will be used\n", prg);
+               "\t              when no file is specified stdin will be used\n", prg);
 }
 
 BDD subsolve(trans_t *t, BDD new){
@@ -48,7 +48,7 @@ int solve(FILE *inputstream, char *lurd)
 
        //Read screen
        time_start_read = clock();
-       sokoban_screen *screen = parse_screen(inputstream, true);
+       sokoban_screen *screen = parse_screen(inputstream, false);
        if (screen == NULL) {
                printf("Something went wrong encoding the screen\n");
                return 2;
@@ -83,8 +83,8 @@ int solve(FILE *inputstream, char *lurd)
        BDD old = sylvan_false;
        BDD new = init->bdd;
        //Do lurd
-       for(unsigned int i = 0; i<strlen(lurd); i++){
-               switch(lurd[i]){
+       while(*lurd != '\0'){
+               switch(*lurd){
                case 'l':
                        new = subsolve(rls->rell, new);
                        break;
@@ -98,9 +98,10 @@ int solve(FILE *inputstream, char *lurd)
                        new = subsolve(rls->reld, new);
                        break;
                default:
-                       printf("Unknown character in lucd: '%c'\n", lurd[i]);
+                       printf("Unknown character in lurd: '%c'\n", *lurd);
                        exit(2);
                }
+               lurd++;
        }
        int iteration = 0;
        bool found = false;
@@ -171,10 +172,6 @@ int main(int argc, char **argv)
        } else {
                DPRINT("Processing: %s\n", argv[optind]);
                FILE *currentfile = fopen(argv[optind], "r");
-               if(currentfile == NULL){
-                       printf("File could not be opened\n");
-                       return 2;
-               }
                DPRINT("Opening file\n");
                return solve(currentfile, lurd);
                DPRINT("Closing file\n");