aboutsummaryrefslogtreecommitdiff
path: root/examples/connect_ssh.c
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-10-02 14:06:41 +0200
committerAndreas Schneider <mail@cynapses.org>2009-10-02 20:26:14 +0200
commitab5b4c7cfe668ee4103de146c2a739532abfc416 (patch)
treeec30d19a18400dbfa0f94bf90262d2c439c724aa /examples/connect_ssh.c
parente78334688fa510a5c859b0367d4d4779efae518a (diff)
downloadlibssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.tar.gz
libssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.tar.xz
libssh-ab5b4c7cfe668ee4103de146c2a739532abfc416.zip
Get rid of the options structure.
Diffstat (limited to 'examples/connect_ssh.c')
-rw-r--r--examples/connect_ssh.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/examples/connect_ssh.c b/examples/connect_ssh.c
index cfc6bb1..90a2f34 100644
--- a/examples/connect_ssh.c
+++ b/examples/connect_ssh.c
@@ -23,24 +23,24 @@ clients must be made or how a client should react.
ssh_session connect_ssh(const char *host, const char *user,int verbosity){
ssh_session session;
- ssh_options options;
int auth=0;
- options=ssh_options_new();
+ session=ssh_new();
+ if (session == NULL) {
+ return NULL;
+ }
+
if(user != NULL){
- if (ssh_options_set_username(options,user) < 0) {
- ssh_options_free(options);
+ if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0) {
+ ssh_disconnect(session);
return NULL;
}
}
- if (ssh_options_set_host(options,host) < 0) {
- ssh_options_free(options);
+ if (ssh_options_set(session, SSH_OPTIONS_HOST, host) < 0) {
return NULL;
}
- ssh_options_set_log_verbosity(options,verbosity);
- session=ssh_new();
- ssh_set_options(session,options);
+ ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
if(ssh_connect(session)){
fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session));
ssh_disconnect(session);