summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/scope.c b/scope.c
index 94ba173..e33c9d9 100644
--- a/scope.c
+++ b/scope.c
@@ -335,8 +335,14 @@ ReadCommands (void)
here = 1;
for (;;) {
printf ("> ");
- if (!fgets (line, sizeof line, stdin))
- break;
+ if (!fgets (line, sizeof line, stdin)) {
+ if(feof(stdin)) {
+ strlcpy(line, "quit", sizeof(line));
+ } else {
+ printf("Error: %s\n", strerror(errno));
+ break;
+ }
+ }
argc = CMDSplitIntoWords(line, argv);
if (argc > 0) {
func = CMDStringToFunc (argv[0]);