commit 86060b535cfbeac2f4bdafd38f17f74879c1a625
parent b03a02198320366849b9dae0f489a3666c3d1f89
Author: sin <sin@2f30.org>
Date: Mon, 30 Jun 2014 19:03:41 +0100
Fix includes across all tools
Diffstat:
51 files changed, 181 insertions(+), 93 deletions(-)
diff --git a/chvt.c b/chvt.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
#include <unistd.h>
+
#include "util.h"
#define KDGKBTYPE 0x4B33 /* get keyboard type */
diff --git a/ctrlaltdel.c b/ctrlaltdel.c
@@ -1,8 +1,10 @@
/* See LICENSE file for copyright and license details. */
#include <sys/syscall.h>
-#include <unistd.h>
+
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "reboot.h"
#include "util.h"
diff --git a/dd.c b/dd.c
@@ -6,23 +6,25 @@
* The original code is at https://github.com/stealth/odd. This
* version of the code has been modified by sin@2f30.org.
*/
+#include <sys/ioctl.h>
+#include <sys/mount.h>
+#include <sys/select.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/vfs.h>
+
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <signal.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
#include <stdint.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/vfs.h>
+#include <string.h>
#include <time.h>
#include <unistd.h>
+
#include "util.h"
struct dd_config {
diff --git a/df.c b/df.c
@@ -1,9 +1,11 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/statvfs.h>
+
#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/statvfs.h>
+
#include "util.h"
static void mnt_show(const char *fsname, const char *dir);
diff --git a/dmesg.c b/dmesg.c
@@ -1,9 +1,11 @@
/* See LICENSE file for copyright and license details. */
#include <sys/klog.h>
-#include <unistd.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+
#include "util.h"
static int dmesg_show(int fd, const void *buf, size_t n);
diff --git a/eject.c b/eject.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
-#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
#include <fcntl.h>
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "util.h"
enum {
diff --git a/fallocate.c b/fallocate.c
@@ -1,9 +1,11 @@
/* See LICENSE file for copyright and license details. */
#include <sys/stat.h>
+
#include <fcntl.h>
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/free.c b/free.c
@@ -1,7 +1,9 @@
/* See LICENSE file for copyright and license details. */
#include <sys/sysinfo.h>
+
#include <stdio.h>
#include <stdlib.h>
+
#include "util.h"
static void
diff --git a/freeramdisk.c b/freeramdisk.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/types.h>
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
+
#include "util.h"
static void
diff --git a/fsfreeze.c b/fsfreeze.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
+
#include "util.h"
#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
diff --git a/getty.c b/getty.c
@@ -1,14 +1,16 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
+
#include "util.h"
static void
diff --git a/halt.c b/halt.c
@@ -1,8 +1,10 @@
/* See LICENSE file for copyright and license details. */
#include <sys/syscall.h>
-#include <unistd.h>
+
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "reboot.h"
#include "util.h"
diff --git a/hwclock.c b/hwclock.c
@@ -1,14 +1,16 @@
/* See LICENSE file for copyright and license details. */
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <unistd.h>
+
#include "rtc.h"
#include "util.h"
diff --git a/id.c b/id.c
@@ -1,13 +1,15 @@
/* See LICENSE file for copyright and license details. */
#include <sys/types.h>
+
+#include <ctype.h>
#include <errno.h>
-#include <unistd.h>
-#include <pwd.h>
#include <grp.h>
+#include <limits.h>
+#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
-#include <limits.h>
-#include <ctype.h>
+#include <unistd.h>
+
#include "util.h"
static void groupid(struct passwd *pw);
diff --git a/insmod.c b/insmod.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
-#include <sys/syscall.h>
#include <sys/stat.h>
+#include <sys/syscall.h>
+
#include <fcntl.h>
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/killall5.c b/killall5.c
@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+
#include "proc.h"
#include "queue.h"
#include "util.h"
diff --git a/login.c b/login.c
@@ -1,15 +1,17 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
#include <unistd.h>
-#include "passwd.h"
+
#include "config.h"
+#include "passwd.h"
#include "util.h"
static int dologin(struct passwd *, int);
diff --git a/lsmod.c b/lsmod.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "text.h"
#include "util.h"
diff --git a/lsusb.c b/lsusb.c
@@ -2,6 +2,7 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+
#include "text.h"
#include "util.h"
diff --git a/mknod.c b/mknod.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <string.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/mkswap.c b/mkswap.c
@@ -1,10 +1,12 @@
/* See LICENSE file for copyright and license details. */
#include <sys/stat.h>
+
#include <fcntl.h>
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+
#include "util.h"
enum { SWAP_UUID_LENGTH = 16, SWAP_LABEL_LENGTH = 16 };
diff --git a/mount.c b/mount.c
@@ -1,13 +1,15 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <limits.h>
#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
-#include <limits.h>
+
#include "util.h"
struct {
diff --git a/mountpoint.c b/mountpoint.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/stat.h>
+#include <sys/types.h>
+
#include <mntent.h>
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/pagesize.c b/pagesize.c
@@ -1,7 +1,8 @@
/* See LICENSE file for copyright and license details. */
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/passwd.c b/passwd.c
@@ -1,14 +1,16 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
+
#include "config.h"
#include "passwd.h"
#include "util.h"
diff --git a/pidof.c b/pidof.c
@@ -1,12 +1,14 @@
/* See LICENSE file for copyright and license details. */
#include <sys/types.h>
-#include <unistd.h>
+
#include <dirent.h>
#include <libgen.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <limits.h>
+#include <unistd.h>
+
#include "proc.h"
#include "queue.h"
#include "util.h"
diff --git a/pivot_root.c b/pivot_root.c
@@ -1,8 +1,10 @@
/* See LICENSE file for copyright and license details. */
#include <sys/syscall.h>
-#include <unistd.h>
+
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/ps.c b/ps.c
@@ -1,4 +1,7 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/ioctl.h>
+#include <sys/sysinfo.h>
+
#include <errno.h>
#include <limits.h>
#include <pwd.h>
@@ -6,9 +9,8 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <sys/ioctl.h>
-#include <sys/sysinfo.h>
#include <unistd.h>
+
#include "proc.h"
#include "util.h"
diff --git a/readahead.c b/readahead.c
@@ -3,6 +3,7 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
+
#include "util.h"
static void
diff --git a/respawn.c b/respawn.c
@@ -1,14 +1,16 @@
/* See LICENSE file for copyright and license details. */
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/select.h>
-#include <sys/time.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
+
#include "util.h"
static void
diff --git a/rmmod.c b/rmmod.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
#include <sys/syscall.h>
-#include <unistd.h>
+
#include <fcntl.h>
+#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <libgen.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/stat.c b/stat.c
@@ -1,14 +1,15 @@
/* See LICENSE file for copyright and license details. */
-#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <unistd.h>
+
#include <errno.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <unistd.h>
+
#include "util.h"
static void show_stat(const char *file, struct stat *st);
diff --git a/su.c b/su.c
@@ -1,14 +1,16 @@
/* See LICENSE file for copyright and license details. */
#include <sys/types.h>
-#include <unistd.h>
+
#include <errno.h>
-#include <pwd.h>
#include <grp.h>
+#include <pwd.h>
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include "passwd.h"
+#include <string.h>
+#include <unistd.h>
+
#include "config.h"
+#include "passwd.h"
#include "util.h"
extern char **environ;
diff --git a/swapoff.c b/swapoff.c
@@ -1,10 +1,12 @@
/* See LICENSE file for copyright and license details. */
#include <sys/swap.h>
-#include <mntent.h>
+
#include <errno.h>
+#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "util.h"
static void
diff --git a/swapon.c b/swapon.c
@@ -1,10 +1,12 @@
/* See LICENSE file for copyright and license details. */
#include <sys/swap.h>
-#include <mntent.h>
+
#include <errno.h>
+#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "util.h"
static void
diff --git a/switch_root.c b/switch_root.c
@@ -1,14 +1,16 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/mount.h>
+#include <sys/stat.h>
+#include <sys/vfs.h>
+
#include <dirent.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <sys/vfs.h>
#include <unistd.h>
+
#include "util.h"
#define RAMFS_MAGIC 0x858458f6 /* some random number */
diff --git a/sysctl.c b/sysctl.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+
#include "text.h"
#include "util.h"
diff --git a/truncate.c b/truncate.c
@@ -1,11 +1,13 @@
/* See LICENSE file for copyright and license details. */
#include <sys/stat.h>
+
+#include <errno.h>
#include <fcntl.h>
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/umount.c b/umount.c
@@ -1,9 +1,11 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/mount.h>
+
#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/mount.h>
+
#include "util.h"
static int umountall(int);
diff --git a/unshare.c b/unshare.c
@@ -1,10 +1,11 @@
/* See LICENSE file for copyright and license details. */
-#include <sched.h>
#include <errno.h>
-#include <unistd.h>
+#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/uptime.c b/uptime.c
@@ -1,10 +1,12 @@
/* See LICENSE file for copyright and license details. */
#include <sys/sysinfo.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <utmpx.h>
+
#include "util.h"
static void
diff --git a/util/ealloc.c b/util/ealloc.c
@@ -1,6 +1,7 @@
/* See LICENSE file for copyright and license details. */
#include <stdlib.h>
#include <string.h>
+
#include "../util.h"
void *
diff --git a/util/explicit_bzero.c b/util/explicit_bzero.c
@@ -1,5 +1,6 @@
/* See LICENSE file for copyright and license details. */
#include <string.h>
+
#include "../util.h"
static void *(*volatile explicit_memset)(void *, int, size_t) = memset;
diff --git a/util/passwd.c b/util/passwd.c
@@ -1,4 +1,7 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/resource.h>
+#include <sys/time.h>
+
#include <errno.h>
#include <pwd.h>
#include <shadow.h>
@@ -6,8 +9,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/resource.h>
-#include <sys/time.h>
+
#include "../passwd.h"
#include "../text.h"
#include "../util.h"
diff --git a/util/proc.c b/util/proc.c
@@ -1,12 +1,14 @@
/* See LICENSE file for copyright and license details. */
#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
+
#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <limits.h>
+#include <unistd.h>
+
#include "../proc.h"
#include "../util.h"
diff --git a/util/recurse.c b/util/recurse.c
@@ -1,11 +1,12 @@
/* See LICENSE file for copyright and license details. */
+#include <sys/stat.h>
+#include <sys/types.h>
+
#include <dirent.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#include "../util.h"
diff --git a/util/strlcat.c b/util/strlcat.c
@@ -15,7 +15,9 @@
*/
#include <sys/types.h>
+
#include <string.h>
+
#include "../util.h"
/*
diff --git a/util/strlcpy.c b/util/strlcpy.c
@@ -15,7 +15,9 @@
*/
#include <sys/types.h>
+
#include <string.h>
+
#include "../util.h"
/*
diff --git a/util/tty.c b/util/tty.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "../util.h"
void
diff --git a/watch.c b/watch.c
@@ -1,7 +1,8 @@
/* See LICENSE file for copyright and license details. */
-#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+
#include "util.h"
static void
diff --git a/who.c b/who.c
@@ -2,9 +2,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include <time.h>
+#include <unistd.h>
#include <utmp.h>
+
#include "util.h"
static void