X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=listati%2Fsplicecp.c;h=52449e68a92c165b73c667b29411fd4e8293d0d3;hp=0da067bc9c953e5258deed07475e496b6b4dd50c;hb=8e03e6dab3729b15c924991f2f4a59079d7e53d7;hpb=ff82508f36245b117cc70a41204264942cca9288 diff --git a/listati/splicecp.c b/listati/splicecp.c index 0da067b..52449e6 100644 --- a/listati/splicecp.c +++ b/listati/splicecp.c @@ -9,26 +9,6 @@ int main(int argc, char *argv[]) int in_fd, out_fd; int nread, nwrite; ... - /* Main body */ - if ((argc - optind) != 2) { /* There must two argument */ - printf("Wrong number of arguments %d\n", argc - optind); - usage(); - } - /* open pipe, input and output file */ - in_fd = open(argv[optind], O_RDONLY); - if (in_fd < 0) { - printf("Input error %s on %s\n", strerror(errno), argv[optind]); - exit(EXIT_FAILURE); - } - out_fd = open(argv[optind+1], O_CREAT|O_RDWR|O_TRUNC, 0644); - if (out_fd < 0) { - printf("Cannot open %s, error %s\n", argv[optind+1], strerror(errno)); - exit(EXIT_FAILURE); - } - if (pipe(pipefd) == -1) { - perror("Cannot create buffer pipe"); - exit(EXIT_FAILURE); - } /* copy loop */ while (1) { nread = splice(in_fd, NULL, pipefd[1], NULL, size,