aboutsummaryrefslogtreecommitdiff
path: root/tests/connection.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2008-03-17 02:31:22 +0000
committerAris Adamantiadis <aris@0xbadc0de.be>2008-03-17 02:31:22 +0000
commit46b96a145cde14b7ecf4a9608173508aa877b9fa (patch)
treee8ae1288f955d0d09fd5ebb88b2e5edd4487e841 /tests/connection.c
parentebbca06b045cec6367deb4eb7a947cde2090dedc (diff)
downloadlibssh-46b96a145cde14b7ecf4a9608173508aa877b9fa.tar.gz
libssh-46b96a145cde14b7ecf4a9608173508aa877b9fa.tar.xz
libssh-46b96a145cde14b7ecf4a9608173508aa877b9fa.zip
preliminary test suite
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@153 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'tests/connection.c')
-rw-r--r--tests/connection.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/connection.c b/tests/connection.c
new file mode 100644
index 0000000..889c511
--- /dev/null
+++ b/tests/connection.c
@@ -0,0 +1,31 @@
+/*
+This file is distributed in public domain. You can do whatever you want
+with its content.
+*/
+
+#include <libssh/libssh.h>
+#include <stdio.h>
+#include "tests.h"
+SSH_OPTIONS *set_opts(int argc, char **argv){
+ SSH_OPTIONS *options=ssh_options_new();
+ char *host=NULL;
+ if(ssh_options_getopt(options,&argc, argv)){
+ fprintf(stderr,"error parsing command line :%s\n",ssh_get_error(options));
+ return NULL;
+ }
+ int i;
+ while((i=getopt(argc,argv,""))!=-1){
+ switch(i){
+ default:
+ fprintf(stderr,"unknown option %c\n",optopt);
+ }
+ }
+ if(optind < argc)
+ host=argv[optind++];
+ if(host==NULL){
+ fprintf(stderr,"must provide an host name\n");
+ return NULL;
+ }
+ ssh_options_set_host(options,host);
+ return options;
+}