#include "splice.h"
static unsigned int splice_size = SPLICE_SIZE;
+static unsigned int splice_flags;
static int wait_for_poll;
static int usage(char *name)
{
- fprintf(stderr, "%s: [-s splice size] [-w wait for poll] port\n", name);
+ fprintf(stderr, "%s: [-s splice size] [-w wait for poll] [-n non-blocking] port\n", name);
return 1;
}
{
int c, index = 1;
- while ((c = getopt(argc, argv, "s:w:")) != -1) {
+ while ((c = getopt(argc, argv, "s:w:n")) != -1) {
switch (c) {
case 's':
splice_size = atoi(optarg);
wait_for_poll = atoi(optarg);
index++;
break;
+ case 'n':
+ splice_flags |= SPLICE_F_NONBLOCK;
+ index++;
+ break;
default:
return -1;
}
#include "splice.h"
static int splice_flags;
+static unsigned int splice_size = SPLICE_SIZE;
static int usage(char *name)
{
- fprintf(stderr, "... | %s: [-m] out_file\n", name);
+ fprintf(stderr, "... | %s: [-m] [-s splice size] out_file\n", name);
return 1;
}
{
int c, index = 1;
- while ((c = getopt(argc, argv, "m")) != -1) {
+ while ((c = getopt(argc, argv, "ms:")) != -1) {
switch (c) {
case 'm':
splice_flags = SPLICE_F_MOVE;
index++;
break;
+ case 's':
+ splice_size = atoi(optarg);
+ index++;
+ break;
default:
return -1;
}
return error("open");
do {
- int ret = ssplice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, splice_flags);
+ int ret = ssplice(STDIN_FILENO, NULL, fd, NULL, splice_size, splice_flags);
if (ret < 0)
return error("splice");