fix cat
This commit is contained in:
parent
e61dc1ffaa
commit
93ec00d3d6
@ -5,7 +5,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
void cat(const int fd) {
|
void cat(const int fd) {
|
||||||
char buf[4096];
|
char buf[8096];
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
|
|
||||||
while ((len = read(fd, buf, sizeof(buf))) > 0)
|
while ((len = read(fd, buf, sizeof(buf))) > 0)
|
||||||
@ -14,7 +14,7 @@ void cat(const int fd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(const int argc, const char **argv) {
|
int main(const int argc, const char **argv) {
|
||||||
if (argc == 1)
|
if (argc == 1 || argv[1][0] == '-')
|
||||||
cat(STDIN_FILENO);
|
cat(STDIN_FILENO);
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user