summaryrefslogtreecommitdiff
path: root/src/user/app
diff options
context:
space:
mode:
authordzwdz2022-07-26 22:04:19 +0200
committerdzwdz2022-07-26 22:04:19 +0200
commit137dcb3e207b264c467f4b2b13df2316b8b0a67c (patch)
tree29f01a9c4eca62ec6b0f443d8a48eeda563df452 /src/user/app
parent4d19346cf0d2a93eed9afe22e5c2a5d9a30fb37c (diff)
user/libc: fread, fwrite, fclose
Diffstat (limited to 'src/user/app')
-rw-r--r--src/user/app/init/shell.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/user/app/init/shell.c b/src/user/app/init/shell.c
index 795bb5e..253acce 100644
--- a/src/user/app/init/shell.c
+++ b/src/user/app/init/shell.c
@@ -38,7 +38,7 @@ static char *strtrim(char *s) {
static int readline(char *buf, size_t max) {
char c = '\0';
size_t pos = 0;
- while (pos < (max-1) && c != '\n' && file_read(stdin, &c, 1))
+ while (pos < (max-1) && c != '\n' && fread(&c, 1, 1, stdin))
buf[pos++] = c;
buf[pos++] = '\0';
return pos;
@@ -73,16 +73,16 @@ static void cmd_cat_ls(const char *args, bool ls) {
}
while (!file->eof) {
- int len = file_read(file, buf, sizeof buf);
+ int len = fread(buf, 1, sizeof buf, file);
if (len <= 0) break;
if (ls) {
for (int i = 0; i < len; i++)
if (buf[i] == '\0') buf[i] = '\n';
}
- file_write(stdout, buf, len);
+ fwrite(buf, 1, len, stdout);
}
- file_close(file);
+ fclose(file);
}
static void cmd_hexdump(const char *args) {
@@ -166,7 +166,7 @@ void shell_loop(void) {
printf("couldn't open file\n");
} else {
elf_execf(file);
- file_close(file);
+ fclose(file);
printf("elf_execf failed\n");
}
} else if (!strcmp(cmd, "cat")) {