summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/compat.c164
-rw-r--r--common/compat.h23
2 files changed, 0 insertions, 187 deletions
diff --git a/common/compat.c b/common/compat.c
index fe16e07..a22071a 100644
--- a/common/compat.c
+++ b/common/compat.c
@@ -185,170 +185,6 @@ p11_thread_join (p11_thread_t thread)
#endif /* OS_WIN32 */
-#ifndef HAVE_ERR_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-
-static FILE *err_file; /* file to use for error output */
-
-/*
- * This is declared to take a `void *' so that the caller is not required
- * to include <stdio.h> first. However, it is really a `FILE *', and the
- * manual page documents it as such.
- */
-void
-err_set_file (void *fp)
-{
- if (fp)
- err_file = fp;
- else
- err_file = stderr;
-}
-
-void
-err (int eval,
- const char *fmt,
- ...)
-{
- va_list ap;
- va_start(ap, fmt);
- verrc(eval, errno, fmt, ap);
- va_end(ap);
-}
-
-void
-verr (int eval,
- const char *fmt,
- va_list ap)
-{
- verrc(eval, errno, fmt, ap);
-}
-
-void
-errc (int eval,
- int code,
- const char *fmt,
- ...)
-{
- va_list ap;
- va_start(ap, fmt);
- verrc(eval, code, fmt, ap);
- va_end(ap);
-}
-
-void
-verrc (int eval,
- int code,
- const char *fmt,
- va_list ap)
-{
- if (err_file == 0)
- err_set_file((FILE *)0);
- fprintf(err_file, "%s: ", getprogname ());
- if (fmt != NULL) {
- vfprintf(err_file, fmt, ap);
- fprintf(err_file, ": ");
- }
- fprintf(err_file, "%s\n", strerror(code));
- exit(eval);
-}
-
-void
-errx (int eval,
- const char *fmt,
- ...)
-{
- va_list ap;
- va_start(ap, fmt);
- verrx(eval, fmt, ap);
- va_end(ap);
-}
-
-void
-verrx (int eval,
- const char *fmt,
- va_list ap)
-{
- if (err_file == 0)
- err_set_file((FILE *)0);
- fprintf(err_file, "%s: ", getprogname ());
- if (fmt != NULL)
- vfprintf(err_file, fmt, ap);
- fprintf(err_file, "\n");
- exit(eval);
-}
-
-void
-warn (const char *fmt,
- ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarnc(errno, fmt, ap);
- va_end(ap);
-}
-
-void
-vwarn (const char *fmt,
- va_list ap)
-{
- vwarnc(errno, fmt, ap);
-}
-
-void
-warnc (int code,
- const char *fmt,
- ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarnc(code, fmt, ap);
- va_end(ap);
-}
-
-void
-vwarnc (int code,
- const char *fmt,
- va_list ap)
-{
- if (err_file == 0)
- err_set_file((FILE *)0);
- fprintf(err_file, "%s: ", getprogname ());
- if (fmt != NULL)
- {
- vfprintf(err_file, fmt, ap);
- fprintf(err_file, ": ");
- }
- fprintf(err_file, "%s\n", strerror(code));
-}
-
-void
-warnx (const char *fmt,
- ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
-}
-
-void
-vwarnx (const char *fmt,
- va_list ap)
-{
- if(err_file == 0)
- err_set_file((FILE*)0);
- fprintf(err_file, "%s: ", getprogname ());
- if(fmt != NULL)
- vfprintf(err_file, fmt, ap);
- fprintf(err_file, "\n");
-}
-
-#endif /* HAVE_ERR_H */
-
#ifndef HAVE_MEMDUP
void *
diff --git a/common/compat.h b/common/compat.h
index 12b038d..6305768 100644
--- a/common/compat.h
+++ b/common/compat.h
@@ -171,29 +171,6 @@ typedef void * dl_module_t;
#endif /* OS_UNIX */
-#ifdef HAVE_ERR_H
-#include <err.h>
-
-#else /* !HAVE_ERR_H */
-
-#include <stdarg.h>
-void err_set_file (void *fp);
-void err_set_exit (void (*ef)(int));
-void err (int eval, const char *fmt, ...) GNUC_PRINTF (2, 3);
-void verr (int eval, const char *fmt, va_list ap);
-void errc (int eval, int code, const char *fmt, ...) GNUC_PRINTF (3, 4);
-void verrc (int eval, int code, const char *fmt, va_list ap);
-void errx (int eval, const char *fmt, ...) GNUC_PRINTF (2, 3);
-void verrx (int eval, const char *fmt, va_list ap);
-void warn (const char *fmt, ...) GNUC_PRINTF (1, 2);
-void vwarn (const char *fmt, va_list ap);
-void warnc (int code, const char *fmt, ...) GNUC_PRINTF (2, 3);
-void vwarnc (int code, const char *fmt, va_list ap);
-void warnx (const char *fmt, ...) GNUC_PRINTF (1, 2);
-void vwarnx (const char *fmt, va_list ap);
-
-#endif /* !HAVE_ERR_H */
-
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif /* HAVE_ERRNO_H */