diff options
author | Andreas Schneider <mail@cynapses.org> | 2009-04-02 12:42:45 +0000 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2009-04-02 12:42:45 +0000 |
commit | da65ee4dbba6539ed92a28b5d6451b8f174ddcb8 (patch) | |
tree | 6aeb02d0193224457234d6c320e6769c5a9b8097 /libssh/options.c | |
parent | 0dee53353150b1d535d1eec6d1b61a0e9bf22592 (diff) | |
download | libssh-da65ee4dbba6539ed92a28b5d6451b8f174ddcb8.tar.gz libssh-da65ee4dbba6539ed92a28b5d6451b8f174ddcb8.tar.xz libssh-da65ee4dbba6539ed92a28b5d6451b8f174ddcb8.zip |
Improve ssh_options_set_log_function().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@368 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'libssh/options.c')
-rw-r--r-- | libssh/options.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/libssh/options.c b/libssh/options.c index 66870c8..c9b938d 100644 --- a/libssh/options.c +++ b/libssh/options.c @@ -716,15 +716,28 @@ int ssh_options_allow_ssh2(SSH_OPTIONS *opt, int allow) { return 0; } -/** Default is a write on stderr - * \brief Change the writer callback for logging - * \param opt options structure - * \param callback a callback function for the printing - * \warning the message string may contain format string characters. +/** + * @brief Change the writer callback for logging. + * + * Default is a write on stderr. + * + * @param opt The options structure to use. + * + * @param callback A callback function for the printing. + * + * @return 0 on success, < 0 on error. + * + * @warning The message string may contain format string characters. */ -void ssh_options_set_log_function(SSH_OPTIONS *opt, - void (*callback)(const char *message, SSH_SESSION *session, int priority )){ - opt->log_function=callback; +int ssh_options_set_log_function(SSH_OPTIONS *opt, + void (*callback)(const char *message, SSH_SESSION *session, int priority)) { + if (opt == NULL || callback == NULL) { + return -1; + } + + opt->log_function = callback; + + return 0; } /** \brief set this session's logging priority |