allow building libcurl for VxWorks

This commit is contained in:
Yang Tse
2009-06-04 19:11:11 +00:00
parent 13fdb9d8a5
commit 00883822be
9 changed files with 1171 additions and 17 deletions

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2004 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2004 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -24,9 +24,13 @@
#include "setup.h"
#ifdef HAVE_STRERROR_R
# if (!defined(HAVE_POSIX_STRERROR_R) && !defined(HAVE_GLIBC_STRERROR_R)) || \
(defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R))
# error "strerror_r MUST be either POSIX-style or glibc-style"
# if (!defined(HAVE_POSIX_STRERROR_R) && \
!defined(HAVE_GLIBC_STRERROR_R) && \
!defined(HAVE_VXWORKS_STRERROR_R)) || \
(defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \
(defined(HAVE_GLIBC_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \
(defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R))
# error "strerror_r MUST be either POSIX-style, glibc-style or vxworks-style"
# endif
#endif
@@ -641,6 +645,18 @@ const char *Curl_strerror(struct connectdata *conn, int err)
else
snprintf(buf, max, "Unknown error %d", err);
}
#elif defined(HAVE_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)
/*
* The vxworks-style strerror_r() does use the buffer we pass to the function.
* The buffer size should be at least MAXERRSTR_SIZE (150) defined in rtsold.h
*/
{
char buffer[256];
if(OK == strerror_r(err, buffer))
strncpy(buf, buffer, max);
else
snprintf(buf, max, "Unknown error %d", err);
}
#else
{
char *msg = strerror(err);