summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-misc.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-04-24 02:26:06 +0000
committerBruce Momjian <bruce@momjian.us>2002-04-24 02:26:06 +0000
commit30571b549675ea8dfab2aeeb65eaf607072e86e1 (patch)
tree882db49faf84c816e6975e90a30ade765ff4c2bf /src/interfaces/libpq/fe-misc.c
parentdd4ca824cc91f0c3156d4ed9774b03005d9580e0 (diff)
I'm at the win32 error messages once more. The DLL load thingy doesn't
work on all win9x machines, so i made it go thru a l ookup table instead, using the DLL as last resort. I also moved this out of the fe-misc.c file because of the size of the lookup ta ble. Who knows, we might add more other win32 specific code there in the future. I also fixed a small typo in the pg_config.h.win32 that made the compiler compla in about the gnu snprintf declaration. I tried to make this patch with psql coding style. I've successfully tested this on win2k and win98 and it works fine (i.e. the mes sage shows on win98 too, it didn't with the old implementation). Magnus Naeslund
Diffstat (limited to 'src/interfaces/libpq/fe-misc.c')
-rw-r--r--src/interfaces/libpq/fe-misc.c47
1 files changed, 1 insertions, 46 deletions
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index 190d378fd9a..643c81055fc 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -25,7 +25,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.69 2002/04/15 23:34:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-misc.c,v 1.70 2002/04/24 02:26:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,8 +37,6 @@
#include <time.h>
#ifdef WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
#include "win32.h"
#else
#include <unistd.h>
@@ -894,46 +892,3 @@ libpq_gettext(const char *msgid)
return dgettext("libpq", msgid);
}
#endif /* ENABLE_NLS */
-
-#ifdef WIN32
-/*
- * strerror replacement for windows:
- *
- * This works on WIN2000 and newer, but we don't know where to find WinSock
- * error strings on older Windows flavors. If you know, clue us in.
- */
-const char *
-winsock_strerror(int eno)
-{
- static char err_buf[512];
-#define WSSE_MAXLEN (sizeof(err_buf)-1-13) /* 13 for " (0x00000000)" */
- int length;
-
- /* First try the "system table", this works on Win2k and up */
-
- if (FormatMessage(
- FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
- 0,
- eno,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- err_buf,
- WSSE_MAXLEN,
- NULL))
- goto WSSE_GOODEXIT;
-
- /* Insert other possible lookup methods here ... */
-
- /* Everything failed, just tell the user that we don't know the desc */
-
- strcpy(err_buf, "Socket error, no description available.");
-
-WSSE_GOODEXIT:
-
- length = strlen(err_buf);
- sprintf(err_buf + (length < WSSE_MAXLEN ? length : WSSE_MAXLEN),
- " (0x%08X)", eno);
-
- return err_buf;
-}
-
-#endif