mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
cat: Just use fd 0 when no arguments are passed.
I'm not sure why it seemed necessary at some point to open /dev/stdin rather than simply using the already-open fd 0.
This commit is contained in:
parent
6c950f8f83
commit
df8e76a67c
Notes:
sideshowbarker
2024-07-19 14:35:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/df8e76a67ce
1 changed files with 2 additions and 3 deletions
|
@ -8,10 +8,9 @@
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
const char* input_file = argc > 1 ? argv[1] : "/dev/stdin";
|
||||
int fd = open(input_file, O_RDONLY);
|
||||
int fd = argc > 1 ? open(argv[1], O_RDONLY) : 0;
|
||||
if (fd == -1) {
|
||||
printf("failed to open %s: %s\n", input_file, strerror(errno));
|
||||
printf("failed to open %s: %s\n", argv[1], strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
for (;;) {
|
||||
|
|
Loading…
Add table
Reference in a new issue