projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Document a bugfix and isolate it in a test.
[open-adventure.git]
/
main.c
diff --git
a/main.c
b/main.c
index 371b3b67d7a1af9ae14e018f1d372f00927e7d2f..f83c4e0dccb36ddc8e6d9a5e3b80ad08c33dcdb2 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-55,8
+55,13
@@
char *myreadline(const char *prompt)
* logfiles for testing purposes.
*/
/* Normal case - no script arguments */
* logfiles for testing purposes.
*/
/* Normal case - no script arguments */
- if (settings.argc == 0)
- return readline(prompt);
+ if (settings.argc == 0) {
+ char *ln = readline(prompt);
+ if (ln == NULL) {
+ fputs(prompt, stdout);
+ }
+ return ln;
+ }
char *buf = malloc(LINESIZE + 1);
for (;;) {
char *buf = malloc(LINESIZE + 1);
for (;;) {
@@
-82,9
+87,9
@@
char *myreadline(const char *prompt)
} else {
char *ln = fgets(buf, LINESIZE, settings.scriptfp);
if (ln != NULL) {
} else {
char *ln = fgets(buf, LINESIZE, settings.scriptfp);
if (ln != NULL) {
-
fputs(PROMPT
, stdout);
+
fputs(prompt
, stdout);
fputs(ln, stdout);
fputs(ln, stdout);
-
return ln;
+ return ln;
}
}
}
}
}
}
@@
-1074,7
+1079,7
@@
static bool do_move(void)
return true;
}
return true;
}
-static bool do_command()
+static bool do_command(
void
)
/* Get and execute a command */
{
static command_t command;
/* Get and execute a command */
{
static command_t command;