1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2011 Index Data
3 * See the file LICENSE for details.
8 * \brief errno utilities
10 * This file unlike other files in YAZ core is thread-aware, due to
25 #include <yaz/errno.h>
36 void yaz_set_errno(int v)
41 void yaz_strerror(char *buf, size_t bufsz)
52 FORMAT_MESSAGE_FROM_SYSTEM,
55 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default lang */
66 strerror_r(errno, buf, bufsz);
67 /* if buffer is unset - use strerror anyway (GLIBC bug) */
69 strcpy(buf, strerror(yaz_errno()));
71 strcpy(buf, strerror(yaz_errno()));
75 if ((cp = strrchr(buf, '\n')))
77 if ((cp = strrchr(buf, '\r')))
83 * c-file-style: "Stroustrup"
84 * indent-tabs-mode: nil
86 * vim: shiftwidth=4 tabstop=8 expandtab