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.
24 lines
403 B
24 lines
403 B
#include <litc.h>
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
if (argc <= 1)
|
|
errx(-1, "usage: %s file1 [file2]...", argv[0]);
|
|
|
|
int i;
|
|
for (i = 1; i < argc; i++) {
|
|
int fd;
|
|
fd = open(argv[i], O_RDONLY, 0);
|
|
if (fd < 0)
|
|
err(-1, "open");
|
|
char buf[512];
|
|
long ret;
|
|
while ((ret = read(fd, buf, sizeof(buf))) > 0)
|
|
write(1, buf, ret);
|
|
if (ret < 0)
|
|
err(-1, "read");
|
|
close(fd);
|
|
}
|
|
return 0;
|
|
}
|