summaryrefslogtreecommitdiff
path: root/w32/subproc/w32err.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1996-07-19 21:41:07 +0000
committerRoland McGrath <roland@redhat.com>1996-07-19 21:41:07 +0000
commitfc47a2c83c4b6c6d47f3c73fd3879fc92eb9c4b3 (patch)
treeaee171b39ecfd5ba9ed6b747291cb2a802d5894f /w32/subproc/w32err.c
parent561b3843134b03629384a73cdc2a2e5242fd39ed (diff)
downloadgunmake-fc47a2c83c4b6c6d47f3c73fd3879fc92eb9c4b3.tar.gz
updated w32 code by tulloh
Diffstat (limited to 'w32/subproc/w32err.c')
-rw-r--r--w32/subproc/w32err.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/w32/subproc/w32err.c b/w32/subproc/w32err.c
index e4e8835..8abd75b 100644
--- a/w32/subproc/w32err.c
+++ b/w32/subproc/w32err.c
@@ -1,51 +1,51 @@
-#include <windows.h>
-#include "w32err.h"
-
-/*
- * Description: the win32 version of perror()
- *
- * Returns: a pointer to a static error
- *
- * Notes/Dependencies: I got this from
- * comp.os.ms-windows.programmer.win32
- */
-char *
-map_win32_error_to_string (DWORD ercode) {
-/* __declspec (thread) necessary if you will use multiple threads */
-__declspec (thread) static char szMessageBuffer[128];
-
- /* Fill message buffer with a default message in
- * case FormatMessage fails
- */
- wsprintf (szMessageBuffer, "Error %ld", ercode);
-
- /*
- * Special code for winsock error handling.
- */
- if (ercode > WSABASEERR) {
- HMODULE hModule = GetModuleHandle("wsock32");
- if (hModule != NULL) {
- FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,
- hModule,
- ercode,
- LANG_NEUTRAL,
- szMessageBuffer,
- sizeof(szMessageBuffer),
- NULL);
- FreeLibrary(hModule);
- }
- } else {
- /*
- * Default system message handling
- */
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- ercode,
- LANG_NEUTRAL,
- szMessageBuffer,
- sizeof(szMessageBuffer),
- NULL);
- }
- return szMessageBuffer;
-}
-
+#include <windows.h>
+#include "w32err.h"
+
+/*
+ * Description: the win32 version of perror()
+ *
+ * Returns: a pointer to a static error
+ *
+ * Notes/Dependencies: I got this from
+ * comp.os.ms-windows.programmer.win32
+ */
+char *
+map_win32_error_to_string (DWORD ercode) {
+/* __declspec (thread) necessary if you will use multiple threads */
+__declspec (thread) static char szMessageBuffer[128];
+
+ /* Fill message buffer with a default message in
+ * case FormatMessage fails
+ */
+ wsprintf (szMessageBuffer, "Error %ld", ercode);
+
+ /*
+ * Special code for winsock error handling.
+ */
+ if (ercode > WSABASEERR) {
+ HMODULE hModule = GetModuleHandle("wsock32");
+ if (hModule != NULL) {
+ FormatMessage(FORMAT_MESSAGE_FROM_HMODULE,
+ hModule,
+ ercode,
+ LANG_NEUTRAL,
+ szMessageBuffer,
+ sizeof(szMessageBuffer),
+ NULL);
+ FreeLibrary(hModule);
+ }
+ } else {
+ /*
+ * Default system message handling
+ */
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ ercode,
+ LANG_NEUTRAL,
+ szMessageBuffer,
+ sizeof(szMessageBuffer),
+ NULL);
+ }
+ return szMessageBuffer;
+}
+