summaryrefslogtreecommitdiff
path: root/cli-main.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2004-07-26 02:44:20 +0000
committerMatt Johnston <matt@ucc.asn.au>2004-07-26 02:44:20 +0000
commitb71622a85ed42d2d5bc93bbe48d69d9167f9ae52 (patch)
treea0342c77df2912832910cc72c9fcef0a2f597461 /cli-main.c
parent848e8b84e8a19c1a597d36e1b6e0a75567f4ddac (diff)
downloaddropbear-b71622a85ed42d2d5bc93bbe48d69d9167f9ae52.tar.gz
snapshot of stuff
Diffstat (limited to 'cli-main.c')
-rw-r--r--cli-main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/cli-main.c b/cli-main.c
new file mode 100644
index 0000000..2460060
--- /dev/null
+++ b/cli-main.c
@@ -0,0 +1,33 @@
+#include <includes.h>
+
+int main(int argc, char ** argv) {
+
+ int sock;
+ char* error = NULL;
+ char* hostandport;
+ int len;
+
+ _dropbear_exit = cli_dropbear_exit;
+ _dropbear_log = cli_dropbear_log;
+
+ cli_getopts(argc, argv);
+
+ sock = connect_remote(cli_opts.remotehost, cli_opts.remoteport,
+ 0, &error);
+
+ if (sock < 0) {
+ dropbear_exit("%s", error);
+ }
+
+ /* Set up the host:port log */
+ len = strlen(cli_opts.remotehost);
+ len += 10; /* 16 bit port and leeway*/
+ hostandport = (char*)m_malloc(len);
+ snprintf(hostandport, len, "%s%d",
+ cli_opts.remotehost, cli_opts.remoteport);
+
+ cli_session(sock, hostandport);
+
+ /* not reached */
+ return -1;
+}