diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-10-02 14:06:41 +0200 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-10-02 20:26:14 +0200 |
commit | ab5b4c7cfe668ee4103de146c2a739532abfc416 (patch) | |
tree | ec30d19a18400dbfa0f94bf90262d2c439c724aa /sample.c | |
parent | e78334688fa510a5c859b0367d4d4779efae518a (diff) | |
download | libssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.tar.gz libssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.tar.xz libssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.zip |
Get rid of the options structure.
Diffstat (limited to 'sample.c')
-rw-r--r-- | sample.c | 23 |
1 files changed, 11 insertions, 12 deletions
@@ -502,7 +502,6 @@ static int auth_kbdint(ssh_session session){ int main(int argc, char **argv){ ssh_session session; - ssh_options options; int auth=0; char *password; char *banner; @@ -512,30 +511,30 @@ int main(int argc, char **argv){ unsigned char *hash = NULL; int hlen; - options=ssh_options_new(); - if(ssh_options_getopt(options,&argc, argv)){ - fprintf(stderr,"error parsing command line :%s\n",ssh_get_error(options)); - usage(); + session = ssh_new(); + + if(ssh_options_getopt(session, &argc, argv)) { + fprintf(stderr, "error parsing command line :%s\n", + ssh_get_error(session)); + usage(); } opts(argc,argv); signal(SIGTERM, do_exit); if (user) { - if (ssh_options_set(options, SSH_OPTIONS_USER, user) < 0) { - ssh_options_free(options); + if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0) { + ssh_disconnect(session); return 1; } } - if (ssh_options_set(options, SSH_OPTIONS_HOST ,host) < 0) { - ssh_options_free(options); + if (ssh_options_set(session, SSH_OPTIONS_HOST ,host) < 0) { + ssh_disconnect(session); return 1; } - ssh_options_parse_config(options, NULL); + ssh_options_parse_config(session, NULL); - session=ssh_new(); - ssh_set_options(session,options); if(ssh_connect(session)){ fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session)); ssh_disconnect(session); |