mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
Fix compilation on freebsd 6.0 which lacks argp.h
This commit is contained in:
@ -21,6 +21,7 @@ check_c_compiler_flag("-fvisibility=hidden" WITH_VISIBILITY_HIDDEN)
|
|||||||
endif(CMAKE_COMPILER_IS_GNUC)
|
endif(CMAKE_COMPILER_IS_GNUC)
|
||||||
|
|
||||||
# HEADER FILES
|
# HEADER FILES
|
||||||
|
check_include_file(argp.h HAVE_ARGP_H)
|
||||||
check_include_file(pty.h HAVE_PTY_H)
|
check_include_file(pty.h HAVE_PTY_H)
|
||||||
check_include_file(terminos.h HAVE_TERMIOS_H)
|
check_include_file(terminos.h HAVE_TERMIOS_H)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
@ -14,7 +14,10 @@ clients must be made or how a client should react.
|
|||||||
|
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include <libssh/server.h>
|
#include <libssh/server.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -34,7 +37,7 @@ static int auth_password(char *user, char *password){
|
|||||||
return 0;
|
return 0;
|
||||||
return 1; // authenticated
|
return 1; // authenticated
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
const char *argp_program_version = "libssh server example "
|
const char *argp_program_version = "libssh server example "
|
||||||
SSH_STRINGIFY(LIBSSH_VERSION);
|
SSH_STRINGIFY(LIBSSH_VERSION);
|
||||||
const char *argp_program_bug_address = "<libssh@libssh.org>";
|
const char *argp_program_bug_address = "<libssh@libssh.org>";
|
||||||
@ -135,6 +138,7 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) {
|
|||||||
|
|
||||||
/* Our argp parser. */
|
/* Our argp parser. */
|
||||||
static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};
|
static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};
|
||||||
|
#endif /* HAVE_ARGP_H */
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
ssh_session session;
|
ssh_session session;
|
||||||
@ -153,12 +157,13 @@ int main(int argc, char **argv){
|
|||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY, KEYS_FOLDER "ssh_host_dsa_key");
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY, KEYS_FOLDER "ssh_host_dsa_key");
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, KEYS_FOLDER "ssh_host_rsa_key");
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, KEYS_FOLDER "ssh_host_rsa_key");
|
||||||
|
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
/*
|
/*
|
||||||
* Parse our arguments; every option seen by parse_opt will
|
* Parse our arguments; every option seen by parse_opt will
|
||||||
* be reflected in arguments.
|
* be reflected in arguments.
|
||||||
*/
|
*/
|
||||||
argp_parse (&argp, argc, argv, 0, 0, sshbind);
|
argp_parse (&argp, argc, argv, 0, 0, sshbind);
|
||||||
|
#endif
|
||||||
if(ssh_bind_listen(sshbind)<0){
|
if(ssh_bind_listen(sshbind)<0){
|
||||||
printf("Error listening to socket: %s\n",ssh_get_error(sshbind));
|
printf("Error listening to socket: %s\n",ssh_get_error(sshbind));
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user