From 37ecd725e58c41820e01f15c1ef4fb2c07014aa9 Mon Sep 17 00:00:00 2001 From: Timo Schulz Date: Wed, 3 Nov 2004 20:03:46 +0000 Subject: 2004-11-03 Timo Schulz * strgutil.c (w32_strerror): New. * ttyio.c (init_ttyfp, tty_printf, do_get): Use it here. * iobuf.c (fd_cache_open, file_filter): Likewise. (iobuf_seek, translate_file_handle): Likewise. --- util/strgutil.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'util/strgutil.c') diff --git a/util/strgutil.c b/util/strgutil.c index 080914e0a..20faa64f4 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -1260,4 +1260,20 @@ asprintf (char **buf, const char *fmt, ...) return status; } +const char * +w32_strerror (int w32_errno) +{ + static char strerr[256]; + int ec = (int)GetLastError (); + + if (w32_errno == 0) + w32_errno = ec; + FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, w32_errno, + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), + strerr, DIM (strerr)-1, NULL); + return strerr; +} #endif /*_WIN32*/ + + + -- cgit