[PATCH] provide alternatives for err, errx, warn and warnx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Solaris lacks err, errx, warn and warnx.  This also means the err.h
header doesn't exist.
Removed err.h include from all files, and included err.h or
replacement_err.h from c.h instead.  This requires a replacement lib to
be linked in when these functions are used.  Currently only done for lib
and shlibs/blkid.  (I have no way to verify if it would work.)
At the same time, use strnlen replacement from strutils.c.

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -177,6 +177,8 @@
 
 AC_CHECK_FUNCS(
 	[inet_aton \
+	err \
+	errx \
 	futimens \
 	fstat64 \
 	fsync \
@@ -206,6 +208,8 @@
 	posix_fadvise \
 	getmntinfo \
 	__secure_getenv \
+	warn \
+	warnx \
 	rpmatch])
 AC_FUNC_FSEEKO
 
diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c
--- 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
--- a/include/c.h
+++ b/include/c.h
@@ -6,6 +6,13 @@
 #define UTIL_LINUX_C_H
 
 #include <limits.h>
+#include <stdint.h>
+
+#ifdef HAVE_ERR_H
+# include <err.h>
+#else
+# include "replacement_err.h"
+#endif
 
 /*
  * Compiler specific stuff
diff --git a/include/replacement_err.h b/include/replacement_err.h
new file mode 100644
--- /dev/null
+++ b/include/replacement_err.h
@@ -0,0 +1,27 @@
+/*
+ * emulations of common functions from err.h
+ * Fabian Groffen <grobian@xxxxxxxxxx>
+ */
+
+#ifndef REPLACEMENT_ERR_H
+#define REPLACEMENT_ERR_H 1
+
+void errmsg(char doexit, int excode, char adderr, const char *fmt, ...);
+
+#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
diff --git a/include/xalloc.h b/include/xalloc.h
--- a/include/xalloc.h
+++ b/include/xalloc.h
@@ -11,7 +11,7 @@
 #define UTIL_LINUX_XALLOC_H
 
 #include <stdlib.h>
-#include <err.h>
+#include "c.h"
 
 static inline __attribute__((alloc_size(1)))
 void *xmalloc(const size_t size)
diff --git a/lib/Makefile.am b/lib/Makefile.am
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,5 +1,8 @@
 include $(top_srcdir)/config/include-Makefile.am
 
+noinst_LTLIBRARIES = libreplace.la
+libreplace_la_SOURCES = err.c
+
 AM_CPPFLAGS += -DTEST_PROGRAM
 
 noinst_PROGRAMS = test_blkdev test_ismounted test_wholedisk test_mangle \
@@ -11,15 +14,19 @@
 endif
 
 test_blkdev_SOURCES = blkdev.c
+test_blkdev_LDADD = libreplace.la
 test_ismounted_SOURCES = ismounted.c
 test_wholedisk_SOURCES = wholedisk.c
 test_mangle_SOURCES = mangle.c
 test_at_SOURCES = at.c
+test_at_LDADD = libreplace.la
 test_strutils_SOURCES = strutils.c
+test_strutils_LDADD = libreplace.la
 if LINUX
 test_cpuset_SOURCES = cpuset.c
 endif
 test_tt_SOURCES = tt.c
+test_tt_LDADD = libreplace.la
 test_canonicalize_SOURCES = canonicalize.c
 
 if LINUX
diff --git a/lib/at.c b/lib/at.c
--- 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 @@
 }
 
 #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
--- 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 @@
 #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
--- 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 @@
 
 #ifdef TEST_PROGRAM
 
-#include <err.h>
 #include <getopt.h>
 
 int main(int argc, char *argv[])
diff --git a/lib/err.c b/lib/err.c
new file mode 100644
--- /dev/null
+++ b/lib/err.c
@@ -0,0 +1,31 @@
+/*
+ * emulations of common functions from err.h
+ * Fabian Groffen <grobian@xxxxxxxxxx>
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+
+#include "c.h"
+
+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);
+}
+
diff --git a/lib/mangle.c b/lib/mangle.c
--- 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 @@
 }
 
 #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
--- 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
--- a/lib/tt.c
+++ b/lib/tt.c
@@ -692,7 +692,6 @@
 }
 
 #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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- a/login-utils/vipw.c
+++ b/login-utils/vipw.c
@@ -60,13 +60,13 @@
 #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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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>
 
@@ -36,6 +35,7 @@
 #include "nls.h"
 #include "xalloc.h"
 #include "strutils.h"
+#include "c.h"
 
 struct wipe_desc {
 	loff_t		offset;		/* magic string offset */
diff --git a/mount/swapon.c b/mount/swapon.c
--- 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
--- 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
--- 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
--- a/schedutils/ionice.c
+++ b/schedutils/ionice.c
@@ -14,11 +14,11 @@
 #include <sys/ptrace.h>
 #include <sys/syscall.h>
 #include <asm/unistd.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
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -27,12 +27,12 @@
 #include <errno.h>
 #include <string.h>
 #include <ctype.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/Makefile.am b/shlibs/blkid/samples/Makefile.am
--- a/shlibs/blkid/samples/Makefile.am
+++ b/shlibs/blkid/samples/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/config/include-Makefile.am
 
 AM_CPPFLAGS += -I$(ul_libblkid_incdir)
-AM_LDFLAGS += $(ul_libblkid_la)
+AM_LDFLAGS += $(ul_libblkid_la) ../../../lib/libreplace.la
 
 noinst_PROGRAMS = topology partitions mkfs superblocks
 
diff --git a/shlibs/blkid/samples/mkfs.c b/shlibs/blkid/samples/mkfs.c
--- 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
--- 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
--- 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
--- 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/blkid/src/Makefile.am b/shlibs/blkid/src/Makefile.am
--- a/shlibs/blkid/src/Makefile.am
+++ b/shlibs/blkid/src/Makefile.am
@@ -33,7 +33,8 @@
 		     $(top_srcdir)/lib/md5.c \
 		     $(top_srcdir)/lib/crc32.c \
 		     $(top_srcdir)/include/list.h \
-		     $(top_srcdir)/lib/env.c
+		     $(top_srcdir)/lib/env.c \
+		     $(top_srcdir)/lib/strutils.c
 
 nodist_libblkid_la_SOURCES = blkid.h
 
diff --git a/shlibs/mount/samples/mount.c b/shlibs/mount/samples/mount.c
--- 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
--- 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 @@
 }
 
 #ifdef TEST_PROGRAM
-#include <err.h>
 
 mnt_lock *lock;
 
diff --git a/sys-utils/ctrlaltdel.c b/sys-utils/ctrlaltdel.c
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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>
@@ -35,6 +34,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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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 */
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux