summaryrefslogtreecommitdiff
path: root/src/user/app/init/shell.c
diff options
context:
space:
mode:
authordzwdz2022-07-26 22:10:20 +0200
committerdzwdz2022-07-26 22:10:20 +0200
commit8af714e59d16f186fd9173edba4fb2699690947a (patch)
treea7df70cd7a6170ff95a9b85fe84c467a648c1be3 /src/user/app/init/shell.c
parent137dcb3e207b264c467f4b2b13df2316b8b0a67c (diff)
user/libc: make FILE an opaque type
Diffstat (limited to 'src/user/app/init/shell.c')
-rw-r--r--src/user/app/init/shell.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/user/app/init/shell.c b/src/user/app/init/shell.c
index 253acce..e53d7d9 100644
--- a/src/user/app/init/shell.c
+++ b/src/user/app/init/shell.c
@@ -72,7 +72,7 @@ static void cmd_cat_ls(const char *args, bool ls) {
return;
}
- while (!file->eof) {
+ while (!feof(file)) {
int len = fread(buf, 1, sizeof buf, file);
if (len <= 0) break;
@@ -135,6 +135,8 @@ void shell_loop(void) {
printf("%x$ ", level);
readline(buf, 256);
+ if (feof(stdin))
+ _syscall_exit(0);
redir = strtrim(strsplit(buf, '>'));
cmd = strtrim(buf);
args = strtrim(strsplit(cmd, 0));