Removed advent.info and added to .gitignore
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index b01662f5120f4739cea47623b433c7e15ae58cc2..0b28f00a2411e4b1673e9836b604c9c24f22be31 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -252,7 +252,10 @@ char* get_input()
             input = NULL;
             size_t n = 0;
             if (isatty(0))
+            // LCOV_EXCL_START
+            // Should be unreachable in tests, as they will use a non-interactive shell.
                 printf("%s", input_prompt);
+            // LCOV_EXCL_STOP 
             IGNORE(getline(&input, &n, stdin));
         }
 
@@ -289,10 +292,13 @@ bool yes(const char* question, const char* yes_response, const char* no_response
         speak(question);
 
         reply = get_input();
-       if (reply == NULL) {
-         linenoiseFree(reply);
-         exit(EXIT_SUCCESS);
-       }
+        if (reply == NULL) {
+            // LCOV_EXCL_START
+            // Should be unreachable. Reply should never be NULL
+            linenoiseFree(reply);
+            exit(EXIT_SUCCESS);
+            // LCOV_EXCL_STOP 
+        }
 
         char* firstword = (char*) xmalloc(strlen(reply)+1);
         sscanf(reply, "%s", firstword);
@@ -411,7 +417,7 @@ long vocab(long id, long init)
             lexeme = -1;
             if (init < 0)
                 return (lexeme);
-            BUG(REQUIRED_VOCABULARY_WORD_NOT_FOUND);
+            BUG(REQUIRED_VOCABULARY_WORD_NOT_FOUND); // LCOV_EXCL_LINE
         }
         if (init >= 0 && KTAB[i] / 1000 != init)
             continue;
@@ -422,7 +428,7 @@ long vocab(long id, long init)
             return (lexeme);
         }
     }
-    BUG(RAN_OFF_END_OF_VOCABULARY_TABLE);
+    BUG(RAN_OFF_END_OF_VOCABULARY_TABLE); // LCOV_EXCL_LINE
 }
 
 void juggle(long object)
@@ -690,10 +696,12 @@ void datime(long* d, long* t)
     *t = (long) tv.tv_usec;
 }
 
+// LCOV_EXCL_START
 void bug(enum bugtype num, const char *error_string)
 {
     fprintf(stderr, "Fatal error %d, %s.\n", num, error_string);
     exit(EXIT_FAILURE);
 }
+// LCOV_EXCL_STOP
 
 /* end */