From f6db686846480e0611879c5f4751955a53859808 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 5 Feb 2013 14:15:12 +0100 Subject: Remove the unused err() function and friends We want to use p11_message in our commands anyway, since that allows us control with --verbose and --quiet. --- common/compat.c | 164 -------------------------------------------------------- common/compat.h | 23 -------- 2 files changed, 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 -#include -#include -#include - -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 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 - -#else /* !HAVE_ERR_H */ - -#include -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 #endif /* HAVE_ERRNO_H */ -- cgit v1.2.1