>From 7da5d6deee61ae6dd4a5e37101dbf463eedec6d7 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Thu, 23 Sep 2010 02:19:42 +0200
Subject: [PATCH] Kill wstrerror

As far as i can tell, all current targets have strerror().

Signed-off-by: Tamas TEVESZ <[email protected]>
---
 WINGs/WINGs/WUtil.h |    4 ----
 WINGs/error.c       |   29 +----------------------------
 configure.ac        |    2 +-
 3 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 6849f52..471c7ec 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -176,10 +176,6 @@ typedef void waborthandler(int);
 
 waborthandler* wsetabort(waborthandler* handler);
 
-
-/* don't free the returned string */
-char* wstrerror(int errnum);
-
 enum {
        WMESSAGE_TYPE_MESSAGE,
        WMESSAGE_TYPE_WARNING,
diff --git a/WINGs/error.c b/WINGs/error.c
index 0e3597f..8bfe15e 100644
--- a/WINGs/error.c
+++ b/WINGs/error.c
@@ -32,33 +32,6 @@ extern char *_WINGS_progname;
 
 #define MAXLINE        1024
 
-/*********************************************************************
- * Returns the system error message associated with error code 'errnum'
- *********************************************************************/
-char *wstrerror(int errnum)
-{
-#if defined(HAVE_STRERROR)
-       return strerror(errnum);
-#elif !defined(HAVE_STRERROR) && defined(BSD)
-       extern int errno, sys_nerr;
-#  ifndef __DECC
-       extern char *sys_errlist[];
-#  endif
-       static char buf[] = "Unknown error 12345678901234567890";
-
-       if (errno < sys_nerr)
-               return sys_errlist[errnum];
-
-       snprintf(buf, sizeof(buf), _("Unknown error %d"), errnum);
-       return buf;
-#else                          /* no strerror() and no sys_errlist[] */
-       static char buf[] = "Error 12345678901234567890";
-
-       snprintf(buf, sizeof(buf), _("Error %d"), errnum);
-       return buf;
-#endif
-}
-
 void __wmessage(int type, void *extra, const char *msg, ...)
 {
        va_list args;
@@ -89,7 +62,7 @@ void __wmessage(int type, void *extra, const char *msg, ...)
                                msg, args);
                        snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
                                ": %s", type == WMESSAGE_TYPE_WSYSERROR ?
-                                   wstrerror(errno) : wstrerror(*(int 
*)extra));
+                                   strerror(errno) : strerror(*(int *)extra));
                break;
                case WMESSAGE_TYPE_MESSAGE:
                        /* FALLTHROUGH */
diff --git a/configure.ac b/configure.ac
index 5372d57..4143d72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,7 +163,7 @@ dnl ============================
 dnl not used anywhere
 AC_FUNC_MEMCMP
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp \
+AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
               setsid atexit mallinfo mkstemp)
 
 dnl Check for inotify
-- 
1.7.0.4


-- 
[-]

mkdir /nonexistent
From 7da5d6deee61ae6dd4a5e37101dbf463eedec6d7 Mon Sep 17 00:00:00 2001
From: Tamas TEVESZ <[email protected]>
Date: Thu, 23 Sep 2010 02:19:42 +0200
Subject: [PATCH] Kill wstrerror

As far as i can tell, all current targets have strerror().

Signed-off-by: Tamas TEVESZ <[email protected]>
---
 WINGs/WINGs/WUtil.h |    4 ----
 WINGs/error.c       |   29 +----------------------------
 configure.ac        |    2 +-
 3 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 6849f52..471c7ec 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -176,10 +176,6 @@ typedef void waborthandler(int);
 
 waborthandler* wsetabort(waborthandler* handler);
 
-
-/* don't free the returned string */
-char* wstrerror(int errnum);
-
 enum {
 	WMESSAGE_TYPE_MESSAGE,
 	WMESSAGE_TYPE_WARNING,
diff --git a/WINGs/error.c b/WINGs/error.c
index 0e3597f..8bfe15e 100644
--- a/WINGs/error.c
+++ b/WINGs/error.c
@@ -32,33 +32,6 @@ extern char *_WINGS_progname;
 
 #define MAXLINE	1024
 
-/*********************************************************************
- * Returns the system error message associated with error code 'errnum'
- *********************************************************************/
-char *wstrerror(int errnum)
-{
-#if defined(HAVE_STRERROR)
-	return strerror(errnum);
-#elif !defined(HAVE_STRERROR) && defined(BSD)
-	extern int errno, sys_nerr;
-#  ifndef __DECC
-	extern char *sys_errlist[];
-#  endif
-	static char buf[] = "Unknown error 12345678901234567890";
-
-	if (errno < sys_nerr)
-		return sys_errlist[errnum];
-
-	snprintf(buf, sizeof(buf), _("Unknown error %d"), errnum);
-	return buf;
-#else				/* no strerror() and no sys_errlist[] */
-	static char buf[] = "Error 12345678901234567890";
-
-	snprintf(buf, sizeof(buf), _("Error %d"), errnum);
-	return buf;
-#endif
-}
-
 void __wmessage(int type, void *extra, const char *msg, ...)
 {
 	va_list args;
@@ -89,7 +62,7 @@ void __wmessage(int type, void *extra, const char *msg, ...)
 				msg, args);
 			snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
 				": %s", type == WMESSAGE_TYPE_WSYSERROR ?
-				    wstrerror(errno) : wstrerror(*(int *)extra));
+				    strerror(errno) : strerror(*(int *)extra));
 		break;
 		case WMESSAGE_TYPE_MESSAGE:
 			/* FALLTHROUGH */
diff --git a/configure.ac b/configure.ac
index 5372d57..4143d72 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,7 +163,7 @@ dnl ============================
 dnl not used anywhere
 AC_FUNC_MEMCMP
 AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp \
+AC_CHECK_FUNCS(gethostname select poll strcasecmp strncasecmp \
 	       setsid atexit mallinfo mkstemp)
 
 dnl Check for inotify
-- 
1.7.0.4

Reply via email to