Add --exec-{send,receive}

This commit is contained in:
Ian Gulliver
2016-02-28 15:53:55 -08:00
parent 29d0b33161
commit 58a8576da8
8 changed files with 198 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
#include <unistd.h>
#include "buf.h"
#include "exec.h"
#include "incoming.h"
#include "outgoing.h"
#include "peer.h"
@@ -127,6 +128,21 @@ bool opts_add_file_append(char *arg) {
return send_new_hello(fd, serializer, NULL);
}
bool opts_add_exec_receive(char *arg) {
exec_new(arg, receive_new, NULL, NULL, &peer_count_in);
return true;
}
bool opts_add_exec_send(char *arg) {
struct serializer *serializer = opts_get_serializer(&arg);
if (!serializer) {
return NULL;
}
exec_new(arg, send_new_wrapper, send_hello, serializer, &peer_count_out);
return true;
}
bool opts_add_stdin(char __attribute__((unused)) *arg) {
int fd = dup(0);
assert(!fcntl(fd, F_SETFD, FD_CLOEXEC));