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

@@ -6,6 +6,7 @@
#include <unistd.h>
#include "beast.h"
#include "exec.h"
#include "hex.h"
#include "incoming.h"
#include "json.h"
@@ -35,6 +36,8 @@ static void print_usage(const char *name) {
"\t--file-read=PATH\n"
"\t--file-write=FORMAT=PATH\n"
"\t--file-append=FORMAT=PATH\n"
"\t--exec-receive=COMMAND\n"
"\t--exec-send=FORMAT=COMMAND\n"
"\t--stdin\n"
"\t--stdout=FORMAT\n"
, name);
@@ -51,6 +54,8 @@ static bool parse_opts(int argc, char *argv[]) {
{"file-read", required_argument, 0, 'r'},
{"file-write", required_argument, 0, 'w'},
{"file-append", required_argument, 0, 'a'},
{"exec-receive", required_argument, 0, 'e'},
{"exec-send", required_argument, 0, 'f'},
{"stdin", no_argument, 0, 'i'},
{"stdout", required_argument, 0, 'o'},
{"help", no_argument, 0, 'h'},
@@ -89,6 +94,14 @@ static bool parse_opts(int argc, char *argv[]) {
handler = opts_add_file_append;
break;
case 'e':
handler = opts_add_exec_receive;
break;
case 'f':
handler = opts_add_exec_send;
break;
case 'i':
handler = opts_add_stdin;
break;
@@ -151,6 +164,7 @@ int main(int argc, char *argv[]) {
send_cleanup();
incoming_cleanup();
outgoing_cleanup();
exec_cleanup();
json_cleanup();
proto_cleanup();