summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--disk-utils/swaplabel.c1
-rw-r--r--include/c.h47
-rw-r--r--include/xalloc.h1
-rw-r--r--lib/at.c2
-rw-r--r--lib/blkdev.c2
-rw-r--r--lib/cpuset.c2
-rw-r--r--lib/mangle.c2
-rw-r--r--lib/strutils.c2
-rw-r--r--lib/tt.c1
-rw-r--r--login-utils/chfn.c2
-rw-r--r--login-utils/chsh.c1
-rw-r--r--login-utils/last.c2
-rw-r--r--login-utils/login.c2
-rw-r--r--login-utils/mesg.c2
-rw-r--r--login-utils/newgrp.c1
-rw-r--r--login-utils/vipw.c2
-rw-r--r--login-utils/wall.c2
-rw-r--r--misc-utils/cal.c1
-rw-r--r--misc-utils/findfs.c2
-rw-r--r--misc-utils/findmnt.c1
-rw-r--r--misc-utils/lsblk.c2
-rw-r--r--misc-utils/namei.c1
-rw-r--r--misc-utils/scriptreplay.c2
-rw-r--r--misc-utils/wipefs.c2
-rw-r--r--mount/swapon.c2
-rw-r--r--partx/partx.c1
-rw-r--r--schedutils/chrt.c1
-rw-r--r--schedutils/ionice.c3
-rw-r--r--schedutils/taskset.c3
-rw-r--r--shlibs/blkid/samples/mkfs.c1
-rw-r--r--shlibs/blkid/samples/partitions.c1
-rw-r--r--shlibs/blkid/samples/superblocks.c1
-rw-r--r--shlibs/blkid/samples/topology.c1
-rw-r--r--shlibs/mount/samples/mount.c1
-rw-r--r--shlibs/mount/src/lock.c2
-rw-r--r--sys-utils/ctrlaltdel.c2
-rw-r--r--sys-utils/fallocate.c2
-rw-r--r--sys-utils/fsfreeze.c1
-rw-r--r--sys-utils/fstrim.c2
-rw-r--r--sys-utils/ipcmk.c2
-rw-r--r--sys-utils/ipcs.c2
-rw-r--r--sys-utils/ldattach.c1
-rw-r--r--sys-utils/lscpu.c2
-rw-r--r--sys-utils/renice.c2
-rw-r--r--sys-utils/rtcwake.c2
-rw-r--r--sys-utils/switch_root.c2
-rw-r--r--sys-utils/unshare.c2
-rw-r--r--text-utils/column.c2
-rw-r--r--text-utils/rev.c2
-rw-r--r--text-utils/tailf.c2
-rw-r--r--text-utils/ul.c2
52 files changed, 84 insertions, 52 deletions
diff --git a/configure.ac b/configure.ac
index ee3e71e90..7b5ffff18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,6 +175,8 @@ AC_CHECK_DECL([lseek64],
AC_CHECK_FUNCS(
[inet_aton \
+ err \
+ errx \
futimens \
fstat64 \
fsync \
@@ -204,6 +206,8 @@ AC_CHECK_FUNCS(
posix_fadvise \
getmntinfo \
__secure_getenv \
+ warn \
+ warnx \
rpmatch])
AC_FUNC_FSEEKO
diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c
index 9dc20b49e..86b3199e4 100644
--- a/disk-utils/swaplabel.c
+++ b/disk-utils/swaplabel.c
@@ -18,7 +18,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
-#include <err.h>
#include <blkid.h>
#include <getopt.h>
diff --git a/include/c.h b/include/c.h
index 815463881..0db8b2b59 100644
--- a/include/c.h
+++ b/include/c.h
@@ -6,6 +6,15 @@
#define UTIL_LINUX_C_H
#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+
+#ifdef HAVE_ERR_H
+# include <err.h>
+#endif
/*
* Compiler specific stuff
@@ -95,6 +104,44 @@
#endif
+#ifndef HAVE_ERR_H
+static inline void
+errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
+{
+ fprintf(stderr, "%s: ", program_invocation_short_name);
+ if (fmt != NULL) {
+ va_list argp;
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ va_end(argp);
+ if (adderr)
+ fprintf(stderr, ": ");
+ }
+ if (adderr)
+ fprintf(stderr, "%s", strerror(errno));
+ fprintf(stderr, "\n");
+ if (doexit)
+ exit(excode);
+}
+
+#ifndef HAVE_ERR
+# define err(E, FMT...) errmsg(1, E, 1, FMT)
+#endif
+
+#ifndef HAVE_ERRX
+# define errx(E, FMT...) errmsg(1, E, 0, FMT)
+#endif
+
+#ifndef HAVE_WARN
+# define warn(FMT...) errmsg(0, 0, 1, FMT)
+#endif
+
+#ifndef HAVE_WARNX
+# define warnx(FMT...) errmsg(0, 0, 0, FMT)
+#endif
+#endif /* !HAVE_ERR_H */
+
+
static inline __attribute__((const)) int is_power_of_2(unsigned long num)
{
return (num != 0 && ((num & (num - 1)) == 0));
diff --git a/include/xalloc.h b/include/xalloc.h
index 841333c30..0e9ee3248 100644
--- a/include/xalloc.h
+++ b/include/xalloc.h
@@ -11,7 +11,6 @@
#define UTIL_LINUX_XALLOC_H
#include <stdlib.h>
-#include <err.h>
#include <string.h>
#include "c.h"
diff --git a/lib/at.c b/lib/at.c
index 1993f9983..dd667b5b8 100644
--- a/lib/at.c
+++ b/lib/at.c
@@ -9,6 +9,7 @@
#include <sys/stat.h>
#include "at.h"
+#include "c.h"
int fstat_at(int dir, const char *dirname, const char *filename,
struct stat *st, int nofollow)
@@ -56,7 +57,6 @@ FILE *fopen_at(int dir, const char *dirname, const char *filename, int flags,
}
#ifdef TEST_PROGRAM
-#include <err.h>
#include <errno.h>
#include <sys/types.h>
#include <dirent.h>
diff --git a/lib/blkdev.c b/lib/blkdev.c
index 67c4a1ac2..0c27a6df9 100644
--- a/lib/blkdev.c
+++ b/lib/blkdev.c
@@ -22,6 +22,7 @@
#include "blkdev.h"
#include "linux_version.h"
+#include "c.h"
static long
blkdev_valid_offset (int fd, off_t offset) {
@@ -208,7 +209,6 @@ blkdev_get_sector_size(int fd, int *sector_size)
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
-#include <err.h>
int
main(int argc, char **argv)
{
diff --git a/lib/cpuset.c b/lib/cpuset.c
index 0c483fa5e..8cd706ce4 100644
--- a/lib/cpuset.c
+++ b/lib/cpuset.c
@@ -20,6 +20,7 @@
#include <sys/syscall.h>
#include "cpuset.h"
+#include "c.h"
static inline int val_to_char(int v)
{
@@ -303,7 +304,6 @@ int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize)
#ifdef TEST_PROGRAM
-#include <err.h>
#include <getopt.h>
int main(int argc, char *argv[])
diff --git a/lib/mangle.c b/lib/mangle.c
index 17ca80951..99e8281e6 100644
--- a/lib/mangle.c
+++ b/lib/mangle.c
@@ -11,6 +11,7 @@
#include <ctype.h>
#include "mangle.h"
+#include "c.h"
#define isoctal(a) (((a) & ~7) == '0')
@@ -103,7 +104,6 @@ char *unmangle(const char *s, char **end)
}
#ifdef TEST_PROGRAM
-#include <err.h>
#include <errno.h>
int main(int argc, char *argv[])
{
diff --git a/lib/strutils.c b/lib/strutils.c
index 94635b1e8..8089fbe8b 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -8,10 +8,10 @@
#include <inttypes.h>
#include <ctype.h>
#include <errno.h>
-#include <err.h>
#include <sys/stat.h>
#include <locale.h>
#include <string.h>
+#include "c.h"
static int do_scale_by_power (uintmax_t *x, int base, int power)
{
diff --git a/lib/tt.c b/lib/tt.c
index 3bcdea9e0..140149d0f 100644
--- a/lib/tt.c
+++ b/lib/tt.c
@@ -709,7 +709,6 @@ int tt_parse_columns_list(const char *list, int cols[], int *ncols,
}
#ifdef TEST_PROGRAM
-#include <err.h>
#include <errno.h>
enum { MYCOL_NAME, MYCOL_FOO, MYCOL_BAR, MYCOL_PATH };
diff --git a/login-utils/chfn.c b/login-utils/chfn.c
index 64f4ac429..7399b179f 100644
--- a/login-utils/chfn.c
+++ b/login-utils/chfn.c
@@ -30,7 +30,6 @@
#include <unistd.h>
#include <pwd.h>
#include <errno.h>
-#include <err.h>
#include <ctype.h>
#include <getopt.h>
@@ -44,6 +43,7 @@
#include "nls.h"
#include "env.h"
#include "xalloc.h"
+#include "c.h"
#ifdef HAVE_LIBSELINUX
#include <selinux/selinux.h>
diff --git a/login-utils/chsh.c b/login-utils/chsh.c
index 778c4578b..fe610726f 100644
--- a/login-utils/chsh.c
+++ b/login-utils/chsh.c
@@ -22,7 +22,6 @@
*
*
*/
-#include <err.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
diff --git a/login-utils/last.c b/login-utils/last.c
index de733cd58..732343d44 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -29,7 +29,6 @@
/*
* last
*/
-#include <err.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/file.h>
@@ -51,6 +50,7 @@
#include "pathnames.h"
#include "nls.h"
#include "xalloc.h"
+#include "c.h"
#define SECDAY (24*60*60) /* seconds in a day */
#define NO 0 /* false/no */
diff --git a/login-utils/login.c b/login-utils/login.c
index 5584c3202..5486ad918 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -97,7 +97,6 @@
#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
-#include <err.h>
#include <grp.h>
#include <pwd.h>
#include <utmp.h>
@@ -120,6 +119,7 @@
#include "strutils.h"
#include "nls.h"
#include "xalloc.h"
+#include "c.h"
#ifdef HAVE_SECURITY_PAM_MISC_H
# include <security/pam_appl.h>
diff --git a/login-utils/mesg.c b/login-utils/mesg.c
index c24a10926..6176aabfb 100644
--- a/login-utils/mesg.c
+++ b/login-utils/mesg.c
@@ -46,7 +46,6 @@
* - cleanups
*/
-#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@@ -55,6 +54,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "nls.h"
+#include "c.h"
/* exit codes */
diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c
index 2ffe38734..7016cfa63 100644
--- a/login-utils/newgrp.c
+++ b/login-utils/newgrp.c
@@ -14,7 +14,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <err.h>
#ifdef HAVE_CRYPT_H
#include <crypt.h>
diff --git a/login-utils/vipw.c b/login-utils/vipw.c
index 5750e6f92..d3ae51ef9 100644
--- a/login-utils/vipw.c
+++ b/login-utils/vipw.c
@@ -60,13 +60,13 @@ static char version_string[] = "vipw 1.4";
#include <signal.h>
#include <fcntl.h>
#include <errno.h>
-#include <err.h>
#include <paths.h>
#include <unistd.h>
#include "setpwnam.h"
#include "strutils.h"
#include "nls.h"
+#include "c.h"
#ifdef HAVE_LIBSELINUX
#include <selinux/selinux.h>
diff --git a/login-utils/wall.c b/login-utils/wall.c
index fc4d792c4..bc2e38288 100644
--- a/login-utils/wall.c
+++ b/login-utils/wall.c
@@ -47,7 +47,6 @@
#include <sys/time.h>
#include <sys/uio.h>
-#include <err.h>
#include <errno.h>
#include <paths.h>
#include <ctype.h>
@@ -65,6 +64,7 @@
#include "ttymsg.h"
#include "pathnames.h"
#include "carefulputc.h"
+#include "c.h"
void makemsg __P((char *));
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 896c45339..1e5e2cd8f 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -63,7 +63,6 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include <err.h>
#include <errno.h>
#include "c.h"
diff --git a/misc-utils/findfs.c b/misc-utils/findfs.c
index 18608b470..04651b3a5 100644
--- a/misc-utils/findfs.c
+++ b/misc-utils/findfs.c
@@ -8,11 +8,11 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <err.h>
#include <blkid.h>
#include "nls.h"
+#include "c.h"
static void __attribute__((__noreturn__)) usage(int rc)
{
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index f81a0c87f..19a15fb58 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
-#include <err.h>
#include <unistd.h>
#include <getopt.h>
#include <string.h>
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index b07bfb49a..2eb6900ac 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -31,7 +31,6 @@
#include <dirent.h>
#include <fcntl.h>
#include <string.h>
-#include <err.h>
#include <sys/ioctl.h>
#include <inttypes.h>
#include <stdarg.h>
@@ -51,6 +50,7 @@
#include "tt.h"
#include "xalloc.h"
#include "strutils.h"
+#include "c.h"
/* column IDs */
enum {
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index 1c20b3777..2115fe7c9 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -30,7 +30,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
-#include <err.h>
#include <pwd.h>
#include <grp.h>
diff --git a/misc-utils/scriptreplay.c b/misc-utils/scriptreplay.c
index e13edf37e..f8ee9e011 100644
--- a/misc-utils/scriptreplay.c
+++ b/misc-utils/scriptreplay.c
@@ -26,9 +26,9 @@
#include <math.h>
#include <sys/select.h>
#include <unistd.h>
-#include <err.h>
#include "nls.h"
+#include "c.h"
#define SCRIPT_MIN_DELAY 0.0001 /* from original sripreplay.pl */
diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c
index 079a9bccf..9016f2f40 100644
--- a/misc-utils/wipefs.c
+++ b/misc-utils/wipefs.c
@@ -27,7 +27,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
-#include <err.h>
#include <string.h>
#include <limits.h>
@@ -37,6 +36,7 @@
#include "xalloc.h"
#include "strutils.h"
#include "writeall.h"
+#include "c.h"
struct wipe_desc {
loff_t offset; /* magic string offset */
diff --git a/mount/swapon.c b/mount/swapon.c
index 5c9c3be43..49771f5d7 100644
--- a/mount/swapon.c
+++ b/mount/swapon.c
@@ -13,7 +13,6 @@
#include <sys/wait.h>
#include <fcntl.h>
#include <stdint.h>
-#include <err.h>
#include <ctype.h>
#include "bitops.h"
@@ -25,6 +24,7 @@
#include "swapheader.h"
#include "mangle.h"
#include "canonicalize.h"
+#include "c.h"
#define PATH_MKSWAP "/sbin/mkswap"
diff --git a/partx/partx.c b/partx/partx.c
index a65586f12..1a60cb455 100644
--- a/partx/partx.c
+++ b/partx/partx.c
@@ -13,7 +13,6 @@
#include <stdio.h>
#include <fcntl.h>
-#include <err.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index bd7070cca..489f29988 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -27,7 +27,6 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
-#include <err.h>
#include "c.h"
#include "nls.h"
diff --git a/schedutils/ionice.c b/schedutils/ionice.c
index ecfb4fd05..dc18add60 100644
--- a/schedutils/ionice.c
+++ b/schedutils/ionice.c
@@ -12,11 +12,10 @@
#include <getopt.h>
#include <unistd.h>
#include <sys/syscall.h>
-#include <err.h>
#include "nls.h"
-
#include "strutils.h"
+#include "c.h"
static int tolerant;
diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index fa16647da..39b22452e 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -24,12 +24,11 @@
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
-#include <err.h>
#include "cpuset.h"
#include "nls.h"
-
#include "strutils.h"
+#include "c.h"
static void __attribute__((__noreturn__)) usage(FILE *out)
{
diff --git a/shlibs/blkid/samples/mkfs.c b/shlibs/blkid/samples/mkfs.c
index ff6a6322d..5c3ebe79e 100644
--- a/shlibs/blkid/samples/mkfs.c
+++ b/shlibs/blkid/samples/mkfs.c
@@ -10,7 +10,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <err.h>
#include <errno.h>
#include <blkid.h>
diff --git a/shlibs/blkid/samples/partitions.c b/shlibs/blkid/samples/partitions.c
index 8ee559969..3b5273649 100644
--- a/shlibs/blkid/samples/partitions.c
+++ b/shlibs/blkid/samples/partitions.c
@@ -10,7 +10,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <err.h>
#include <errno.h>
#include <blkid.h>
diff --git a/shlibs/blkid/samples/superblocks.c b/shlibs/blkid/samples/superblocks.c
index 276c29e6f..20e39c97e 100644
--- a/shlibs/blkid/samples/superblocks.c
+++ b/shlibs/blkid/samples/superblocks.c
@@ -10,7 +10,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <err.h>
#include <errno.h>
#include <blkid.h>
diff --git a/shlibs/blkid/samples/topology.c b/shlibs/blkid/samples/topology.c
index e73cd9e45..de1c3a5e3 100644
--- a/shlibs/blkid/samples/topology.c
+++ b/shlibs/blkid/samples/topology.c
@@ -10,7 +10,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <err.h>
#include <errno.h>
#include <blkid.h>
diff --git a/shlibs/mount/samples/mount.c b/shlibs/mount/samples/mount.c
index 8095ffccb..38960f8dc 100644
--- a/shlibs/mount/samples/mount.c
+++ b/shlibs/mount/samples/mount.c
@@ -24,7 +24,6 @@
#include <errno.h>
#include <string.h>
#include <getopt.h>
-#include <err.h>
#include <unistd.h>
#include <sys/types.h>
diff --git a/shlibs/mount/src/lock.c b/shlibs/mount/src/lock.c
index ef7498d97..554915876 100644
--- a/shlibs/mount/src/lock.c
+++ b/shlibs/mount/src/lock.c
@@ -29,6 +29,7 @@
#include "pathnames.h"
#include "nls.h"
+#include "c.h"
#include "mountP.h"
@@ -429,7 +430,6 @@ failed:
}
#ifdef TEST_PROGRAM
-#include <err.h>
struct libmnt_lock *lock;
diff --git a/sys-utils/ctrlaltdel.c b/sys-utils/ctrlaltdel.c
index cfab79a3e..d6c83b42f 100644
--- a/sys-utils/ctrlaltdel.c
+++ b/sys-utils/ctrlaltdel.c
@@ -5,13 +5,13 @@
* - added Native Language Support
*/
-#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "linux_reboot.h"
#include "nls.h"
+#include "c.h"
int main(int argc, char *argv[])
{
diff --git a/sys-utils/fallocate.c b/sys-utils/fallocate.c
index e9d7c079a..74e9435fe 100644
--- a/sys-utils/fallocate.c
+++ b/sys-utils/fallocate.c
@@ -30,7 +30,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
-#include <err.h>
#include <limits.h>
#ifndef HAVE_FALLOCATE
@@ -45,6 +44,7 @@
#include "nls.h"
#include "strutils.h"
+#include "c.h"
static void __attribute__((__noreturn__)) usage(FILE *out)
diff --git a/sys-utils/fsfreeze.c b/sys-utils/fsfreeze.c
index 4ca6e5e2a..2dab23f49 100644
--- a/sys-utils/fsfreeze.c
+++ b/sys-utils/fsfreeze.c
@@ -20,7 +20,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <getopt.h>
-#include <err.h>
#include "blkdev.h"
#include "nls.h"
diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c
index 808ff0334..a3a847522 100644
--- a/sys-utils/fstrim.c
+++ b/sys-utils/fstrim.c
@@ -32,7 +32,6 @@
#include <fcntl.h>
#include <limits.h>
#include <getopt.h>
-#include <err.h>
#include <error.h>
#include <errno.h>
@@ -42,6 +41,7 @@
#include "nls.h"
#include "strutils.h"
+#include "c.h"
#ifndef FITRIM
struct fstrim_range {
diff --git a/sys-utils/ipcmk.c b/sys-utils/ipcmk.c
index 2e663bf02..26bf8f6bc 100644
--- a/sys-utils/ipcmk.c
+++ b/sys-utils/ipcmk.c
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
-#include <err.h>
#include <time.h>
#include <unistd.h>
@@ -34,6 +33,7 @@
#include <sys/msg.h>
#include "nls.h"
+#include "c.h"
static const char *progname;
diff --git a/sys-utils/ipcs.c b/sys-utils/ipcs.c
index 2ef5788de..533aaeb66 100644
--- a/sys-utils/ipcs.c
+++ b/sys-utils/ipcs.c
@@ -26,7 +26,6 @@
#include <pwd.h>
#include <grp.h>
#include <unistd.h>
-#include <err.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
@@ -34,6 +33,7 @@
#include <sys/shm.h>
#include "nls.h"
+#include "c.h"
/*-------------------------------------------------------------------*/
/* SHM_DEST and SHM_LOCKED are defined in kernel headers,
diff --git a/sys-utils/ldattach.c b/sys-utils/ldattach.c
index 4fe5a7bb6..5d8381958 100644
--- a/sys-utils/ldattach.c
+++ b/sys-utils/ldattach.c
@@ -23,7 +23,6 @@
#include <errno.h>
#include <termios.h>
#include <unistd.h>
-#include <err.h>
#include "c.h"
#include "nls.h"
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index d59d2e231..373fee14a 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -21,7 +21,6 @@
#include <ctype.h>
#include <dirent.h>
-#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
@@ -37,6 +36,7 @@
#include "cpuset.h"
#include "nls.h"
+#include "c.h"
#define CACHE_MAX 100
diff --git a/sys-utils/renice.c b/sys-utils/renice.c
index 6b1a9726b..b4d96e02f 100644
--- a/sys-utils/renice.c
+++ b/sys-utils/renice.c
@@ -44,8 +44,8 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <err.h>
#include "nls.h"
+#include "c.h"
static int donice(int,int,int);
diff --git a/sys-utils/rtcwake.c b/sys-utils/rtcwake.c
index 06f5c3839..da8c085fe 100644
--- a/sys-utils/rtcwake.c
+++ b/sys-utils/rtcwake.c
@@ -28,7 +28,6 @@
#include <unistd.h>
#include <errno.h>
#include <time.h>
-#include <err.h>
#include <sys/ioctl.h>
#include <sys/time.h>
@@ -41,6 +40,7 @@
#include "pathnames.h"
#include "usleep.h"
#include "strutils.h"
+#include "c.h"
/* constants from legacy PC/AT hardware */
#define RTC_PF 0x40
diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c
index c43225da2..2dfed71a0 100644
--- a/sys-utils/switch_root.c
+++ b/sys-utils/switch_root.c
@@ -32,7 +32,7 @@
#include <errno.h>
#include <ctype.h>
#include <dirent.h>
-#include <err.h>
+#include "c.h"
#ifndef MS_MOVE
#define MS_MOVE 8192
diff --git a/sys-utils/unshare.c b/sys-utils/unshare.c
index 12a725e3b..343a86ee3 100644
--- a/sys-utils/unshare.c
+++ b/sys-utils/unshare.c
@@ -18,7 +18,6 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <err.h>
#include <errno.h>
#include <getopt.h>
#include <sched.h>
@@ -27,6 +26,7 @@
#include <unistd.h>
#include "nls.h"
+#include "c.h"
#ifndef CLONE_NEWSNS
# define CLONE_NEWNS 0x00020000
diff --git a/text-utils/column.c b/text-utils/column.c
index 156de7059..5c6db257e 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -47,12 +47,12 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
-#include <err.h>
#include <errno.h>
#include <getopt.h>
#include "nls.h"
#include "widechar.h"
+#include "c.h"
#ifdef HAVE_WIDECHAR
#define wcs_width(s) wcswidth(s,wcslen(s))
diff --git a/text-utils/rev.c b/text-utils/rev.c
index b69244971..89e5e5855 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -55,12 +55,12 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <err.h>
#include <signal.h>
#include "nls.h"
#include "xalloc.h"
#include "widechar.h"
+#include "c.h"
wchar_t *buf;
diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index 2dcdba3f3..c995d979c 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -35,7 +35,6 @@
#include <fcntl.h>
#include <ctype.h>
#include <errno.h>
-#include <err.h>
#ifdef HAVE_INOTIFY_INIT
#include <sys/inotify.h>
#endif
@@ -43,6 +42,7 @@
#include "nls.h"
#include "xalloc.h"
#include "usleep.h"
+#include "c.h"
#define DEFAULT_LINES 10
diff --git a/text-utils/ul.c b/text-utils/ul.c
index 30f24e9d5..dc0550cc0 100644
--- a/text-utils/ul.c
+++ b/text-utils/ul.c
@@ -47,12 +47,12 @@
#include <stdlib.h> /* for getenv() */
#include <limits.h> /* for INT_MAX */
#include <signal.h> /* for signal() */
-#include <err.h>
#include <errno.h>
#include "nls.h"
#include "xalloc.h"
#include "widechar.h"
+#include "c.h"
#ifdef HAVE_WIDECHAR
static int put1wc(int c) /* Output an ASCII character as a wide character */