aboutsummaryrefslogtreecommitdiff
path: root/libssh/options.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-09-22 20:33:58 +0200
committerAndreas Schneider <mail@cynapses.org>2009-09-22 20:33:58 +0200
commit343e6e482a7e008586a0c9cf60456e5381037af1 (patch)
tree0caa7fc50f71a9ad820256740e7cf7a351fb8a1c /libssh/options.c
parentaae1df0589781dc2db789658f1836d17aeb18413 (diff)
downloadlibssh-343e6e482a7e008586a0c9cf60456e5381037af1.tar.gz
libssh-343e6e482a7e008586a0c9cf60456e5381037af1.tar.xz
libssh-343e6e482a7e008586a0c9cf60456e5381037af1.zip
Added handling of bindport in getopt.
Diffstat (limited to 'libssh/options.c')
-rw-r--r--libssh/options.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libssh/options.c b/libssh/options.c
index 3db4390a..8152c908 100644
--- a/libssh/options.c
+++ b/libssh/options.c
@@ -1087,6 +1087,7 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
char *localaddr = NULL;
char *identity = NULL;
char *port = NULL;
+ char *bindport = NULL;
char **save = NULL;
int i = 0;
int argc = *argcptr;
@@ -1115,7 +1116,7 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
}
opterr = 0; /* shut up getopt */
- while(cont && ((i = getopt(argc, argv, "c:i:Cl:p:vb:rd12")) != -1)) {
+ while(cont && ((i = getopt(argc, argv, "c:i:Cl:p:vb:t:rd12")) != -1)) {
switch(i) {
case 'l':
user = optarg;
@@ -1123,6 +1124,9 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
case 'p':
port = optarg;
break;
+ case 't':
+ bindport = optarg;
+ break;
case 'v':
debuglevel++;
break;
@@ -1246,6 +1250,10 @@ int ssh_options_getopt(SSH_OPTIONS *options, int *argcptr, char **argv) {
}
ssh_options_set(options, SSH_OPTIONS_PORT_STR, port);
+ if (bindport) {
+ i = atoi(bindport);
+ ssh_options_set(options, SSH_OPTIONS_BINDPORT, &i);
+ }
ssh_options_set(options, SSH_OPTIONS_SSH1, &ssh1);
ssh_options_set(options, SSH_OPTIONS_SSH2, &ssh2);