You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riscv-pke/user/app_cat.c

24 lines
446 B

#include "user_lib.h"
#include "util/string.h"
#include "util/types.h"
int main(int argc, char *argv[]) {
int fd;
int MAXBUF = 512;
char buf[MAXBUF];
char *filename = argv[0];
printu("\n======== cat command ========\n");
printu("cat: %s\n", filename);
fd = open(filename, O_RDWR);
printu("file descriptor fd: %d\n", fd);
read_u(fd, buf, MAXBUF);
printu("read content: \n%s\n", buf);
close(fd);
exit(0);
return 0;
}