projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce command encapsulation structure.
[open-adventure.git]
/
misc.c
diff --git
a/misc.c
b/misc.c
index 6042f764d53b51adfd62253565dcc102a70ae048..09244625cfe0c536bb866fcf17eccf21356d5e48 100644
(file)
--- a/
misc.c
+++ b/
misc.c
@@
-257,8
+257,8
@@
char* get_input()
IGNORE(getline(&input, &n, stdin));
}
IGNORE(getline(&input, &n, stdin));
}
- if (input == NULL) // Got EOF;
qu
it.
-
exit(EXIT_SUCCESS
);
+ if (input == NULL) // Got EOF;
return with
it.
+
return(input
);
else if (input[0] == '#') // Ignore comments.
continue;
else // We have a 'normal' line; leave the loop.
else if (input[0] == '#') // Ignore comments.
continue;
else // We have a 'normal' line; leave the loop.
@@
-290,6
+290,10
@@
bool YES(const char* question, const char* yes_response, const char* no_response
speak(question);
reply = get_input();
speak(question);
reply = get_input();
+ if (reply == NULL) {
+ linenoiseFree(reply);
+ exit(EXIT_SUCCESS);
+ }
char* firstword = (char*) xmalloc(strlen(reply)+1);
sscanf(reply, "%s", firstword);
char* firstword = (char*) xmalloc(strlen(reply)+1);
sscanf(reply, "%s", firstword);