mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 11:39:44 +03:00
Add /dev/{stdin,stdout,stderr} as symlinks to /proc/self/fd/{0,1,2}
Also change /bin/cat to open /dev/stdin if no arguments are provided.
This commit is contained in:
parent
5e9ba2ac84
commit
31f44481f3
Notes:
sideshowbarker
2024-07-19 15:52:53 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/31f44481f3e
@ -13,6 +13,9 @@ mknod mnt/dev/psaux c 10 1
|
||||
mknod mnt/dev/ptmx c 5 2
|
||||
mkdir mnt/dev/pts
|
||||
mknod mnt/dev/gui_events c 66 1
|
||||
ln -s /proc/self/fd/0 mnt/dev/stdin
|
||||
ln -s /proc/self/fd/1 mnt/dev/stdout
|
||||
ln -s /proc/self/fd/2 mnt/dev/stderr
|
||||
cp -vR ../Base/* mnt/
|
||||
chown -vR 100:100 mnt/users/anon
|
||||
cp -v ../Userland/sh mnt/bin/sh
|
||||
|
@ -8,13 +8,10 @@
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc != 2) {
|
||||
printf("usage: cat <file>\n");
|
||||
return 1;
|
||||
}
|
||||
int fd = open(argv[1], O_RDONLY);
|
||||
const char* input_file = argc > 1 ? argv[1] : "/dev/stdin";
|
||||
int fd = open(input_file, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
printf("failed to open %s: %s\n", argv[1], strerror(errno));
|
||||
printf("failed to open %s: %s\n", input_file, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
for (;;) {
|
||||
|
Loading…
Reference in New Issue
Block a user