ObjFW
src/exceptions/common.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011, 2012
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #include <string.h>
00018 
00019 #ifndef _WIN32
00020 #if !defined(HAVE_THREADSAFE_GETADDRINFO) && !defined(_PSP)
00021 # include <netdb.h>
00022 #endif
00023 # include <errno.h>
00024 # define GET_ERRNO      errno
00025 # ifndef HAVE_THREADSAFE_GETADDRINFO
00026 #  define GET_AT_ERRNO  h_errno
00027 # else
00028 #  define GET_AT_ERRNO  errno
00029 # endif
00030 # define GET_SOCK_ERRNO errno
00031 # define ERRFMT         "Error string was: %s"
00032 # define ERRPARAM       strerror(errNo)
00033 # if !defined(HAVE_THREADSAFE_GETADDRINFO) && !defined(_PSP)
00034 #  define AT_ERRPARAM   hstrerror(errNo)
00035 # else
00036 #  define AT_ERRPARAM   strerror(errNo)
00037 # endif
00038 #else
00039 # include <windows.h>
00040 # define GET_ERRNO      GetLastError()
00041 # define GET_AT_ERRNO   WSAGetLastError()
00042 # define GET_SOCK_ERRNO WSAGetLastError()
00043 # define ERRFMT         "Error code was: %d"
00044 # define ERRPARAM       errNo
00045 # define AT_ERRPARAM    errNo
00046 #endif
 All Classes Functions Variables Properties