commit - 3376f40ab6a216a96189c9c10b339c5168ba0fd4
commit + 395a1b6bb39c4499d81b39acf5a3ae56531e4729
blob - 5b51015bf6346dc9fc122665c069773dda6027e4 (mode 644)
blob + /dev/null
--- compat/err.c
+++ /dev/null
-/*
- * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "compat.h"
-
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-static void vwarn(const char*, va_list);
-static void vwarnx(const char*, va_list);
-
-static void
-vwarn(const char *fmt, va_list ap)
-{
- fprintf(stderr, "%s: ", getprogname());
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, ": %s\n", strerror(errno));
-}
-
-static void
-vwarnx(const char *fmt, va_list ap)
-{
- fprintf(stderr, "%s: ", getprogname());
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
-}
-
-void
-err(int ret, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vwarn(fmt, ap);
- va_end(ap);
- exit(ret);
-}
-
-void
-errx(int ret, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
- exit(ret);
-}
-
-void
-warn(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vwarn(fmt, ap);
- va_end(ap);
-}
-
-void
-warnx(const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
-}
blob - 4cafbf5b2796445777acdb8d609b7dc8153cd3f2
blob + b0ac36571fd683d0f780a8bd04566a16a4fedab3
--- compat.h
+++ compat.h
#include "config.h"
-#ifdef HAVE_ERR
-# include <err.h>
-#else
-void err(int, const char*, ...);
-void errx(int, const char*, ...);
-void warn(const char*, ...);
-void warnx(const char*, ...);
-#endif
-
#ifndef HAVE_GETPROGNAME
const char *getprogname(void);
#endif
blob - 65d714fbec3ece3b238ab4f8964f732377ab2e62
blob + a25d9a213ef3a95754aa8452672446b34452062e
--- configure.ac
+++ configure.ac
AC_USE_SYSTEM_EXTENSIONS
AC_REPLACE_FUNCS([
- err \
getprogname \
strtonum \
])