From c65f56aefa50a2e2a78a0e45564526ecc921d74f Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Tue, 5 Jul 2005 01:21:44 +0000 Subject: first import git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@1 7dcaeef0-15fb-0310-b436-a5af3365683c --- libssh/error.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 libssh/error.c (limited to 'libssh/error.c') diff --git a/libssh/error.c b/libssh/error.c new file mode 100644 index 0000000..f3db794 --- /dev/null +++ b/libssh/error.c @@ -0,0 +1,56 @@ +/* error.c */ +/* it does contain error processing functions */ +/* +Copyright 2003,04 Aris Adamantiadis + +This file is part of the SSH Library + +The SSH Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or (at your +option) any later version. + +The SSH Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the SSH Library; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, +MA 02111-1307, USA. */ + +#include +#include +#include "libssh/priv.h" + +static int verbosity; + +/* ssh_set_error registers an error with a description. the error code is the class of error, and description is obvious.*/ +void ssh_set_error(SSH_SESSION *session,int code,char *descr,...){ + va_list va; + va_start(va,descr); + vsnprintf(session->error_buffer,ERROR_BUFFERLEN,descr,va); + va_end(va); + session->error_code=code; +} + +char *ssh_get_error(SSH_SESSION *session){ + return session->error_buffer; +} + +int ssh_get_error_code(SSH_SESSION *session){ + return session->error_code; +} + +void ssh_say(int priority, char *format,...){ + va_list va; + va_start(va,format); + if(priority <= verbosity) + vfprintf(stderr,format,va); + va_end(va); +} + +void ssh_set_verbosity(int num){ + verbosity=num; +} -- cgit