From 98fb6169f502d329aaff0e0686a97eae295c2135 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Tue, 27 Feb 2018 15:31:10 -0800 Subject: [PATCH] cdba: Allow host specified on command line Rather than hard coding the host, grab it off the command line. Signed-off-by: Bjorn Andersson --- cdba.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cdba.c b/cdba.c index 4b8284f..e3e104a 100644 --- a/cdba.c +++ b/cdba.c @@ -370,7 +370,7 @@ static void usage(void) { extern const char *__progname; - fprintf(stderr, "usage: %s -b boot.img\n", __progname); + fprintf(stderr, "usage: %s -b -h boot.img\n", __progname); exit(1); } @@ -382,6 +382,7 @@ int main(int argc, char **argv) struct work *work; struct circ_buf recv_buf = { 0 }; const char *board = NULL; + const char *host = NULL; struct stat sb; int ssh_fds[3]; char buf[128]; @@ -391,17 +392,20 @@ int main(int argc, char **argv) int opt; int ret; - while ((opt = getopt(argc, argv, "b:")) != -1) { + while ((opt = getopt(argc, argv, "b:h:")) != -1) { switch (opt) { case 'b': board = optarg; break; + case 'h': + host = optarg; + break; default: usage(); } } - if (optind >= argc || !board) + if (optind >= argc || !board || !host) usage(); fastboot_file = argv[optind]; @@ -412,9 +416,9 @@ int main(int argc, char **argv) request_select_board(board); - ret = fork_ssh("minitux.lan", "sandbox/cdba/bad", ssh_fds); + ret = fork_ssh(host, "sandbox/cdba/bad", ssh_fds); if (ret) - err(1, "failed to connect to flasher.lan"); + err(1, "failed to connect to \"%s\"", host); //sleep(5);