mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +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
1 changed files with 2 additions and 3 deletions
|
@ -8,10 +8,9 @@
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
const char* input_file = argc > 1 ? argv[1] : "/dev/stdin";
|
int fd = argc > 1 ? open(argv[1], O_RDONLY) : 0;
|
||||||
int fd = open(input_file, O_RDONLY);
|
|
||||||
if (fd == -1) {
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue