1
0
mirror of https://github.com/PDP-10/klh10.git synced 2026-02-06 08:25:37 +00:00

EOF on the prompt should not loop infinitely

This commit is contained in:
Olaf Seibert
2015-07-22 01:20:34 +02:00
parent 75c47c9842
commit c9f494a3df

View File

@@ -1032,8 +1032,15 @@ cmdlsetup(struct cmd_s *cm)
fputs(cp, stdout); /* Echo the input line */
} else {
cp = fe_ctycmline(cm->cmd_inp, (int)cm->cmd_left-1);
if (cp == NULL)
return NULL;
if (cp == NULL) {
if (feof(stdin) || ferror(stdin)) {
cp = strncpy(cm->cmd_inp, "exit", (int)cm->cmd_left-1);
fprintf(stdout, "exit\n");
clearerr(stdin);
} else {
return NULL;
}
}
}
len = strlen(cp);