11 static int splice_flags;
12 static unsigned int splice_size = SPLICE_SIZE;
14 static int usage(char *name)
16 fprintf(stderr, "... | %s: [-m] [-s splice size] out_file\n", name);
20 static int parse_options(int argc, char *argv[])
24 while ((c = getopt(argc, argv, "ms:")) != -1) {
27 splice_flags = SPLICE_F_MOVE;
31 splice_size = atoi(optarg);
42 int main(int argc, char *argv[])
46 if (check_input_pipe())
47 return usage(argv[0]);
49 index = parse_options(argc, argv);
50 if (index == -1 || index + 1 > argc)
51 return usage(argv[0]);
53 fd = open(argv[index], O_WRONLY | O_CREAT | O_TRUNC, 0644);
58 int ret = ssplice(STDIN_FILENO, NULL, fd, NULL, splice_size, splice_flags);
61 return error("splice");