diff options
author | Rob Landley <rob@landley.net> | 2012-03-07 19:04:50 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-03-07 19:04:50 -0600 |
commit | f05f660d9c4f18aa4702d723ed7b35f7053ce08c (patch) | |
tree | 3fdb1393a989873a0d6f5a92cb4851031ac6db6f | |
parent | b7a4862fbf0df632837a53e230f4aa9cceb5f578 (diff) | |
download | toybox-f05f660d9c4f18aa4702d723ed7b35f7053ce08c.tar.gz |
Consolidate headers.
-rw-r--r-- | lib/portability.h | 9 | ||||
-rw-r--r-- | toys.h | 5 | ||||
-rw-r--r-- | toys/dirname.c | 1 | ||||
-rw-r--r-- | toys/id.c | 7 | ||||
-rw-r--r-- | toys/ls.c | 8 | ||||
-rw-r--r-- | toys/sort.c | 1 | ||||
-rw-r--r-- | toys/uname.c | 1 | ||||
-rw-r--r-- | toys/unshare.c | 2 | ||||
-rw-r--r-- | toys/who.c | 2 |
9 files changed, 14 insertions, 22 deletions
diff --git a/lib/portability.h b/lib/portability.h index d4edfb6d..0887d873 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -7,8 +7,13 @@ #undef _FORTIFY_SOURCE -// Humor glibc to get dprintf, then #define it to something more portable. -#define _GNU_SOURCE +#define _FILE_OFFSET_BITS 64 + +#define _POSIX_C_SOURCE 200809L +#define _XOPEN_SOURCE 600 +#define _BSD_SOURCE +#define _SVID_SOURCE + #include <stdio.h> #define fdprintf(...) dprintf(__VA_ARGS__) @@ -15,8 +15,11 @@ #include <grp.h> #include <inttypes.h> #include <limits.h> +#include <libgen.h> +#include <math.h> #include <pty.h> #include <pwd.h> +#include <sched.h> #include <setjmp.h> #include <stdarg.h> #include <stdint.h> @@ -31,9 +34,11 @@ #include <sys/sysinfo.h> #include <sys/swap.h> #include <sys/types.h> +#include <sys/utsname.h> #include <sys/wait.h> #include <unistd.h> #include <utime.h> +#include <utmpx.h> #undef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 diff --git a/toys/dirname.c b/toys/dirname.c index bac0fd40..5dc60181 100644 --- a/toys/dirname.c +++ b/toys/dirname.c @@ -18,7 +18,6 @@ config DIRNAME */ #include "toys.h" -#include <libgen.h> void dirname_main(void) { @@ -25,9 +25,6 @@ config ID -u Show only the effective user ID */ -#include <sys/types.h> -#include <pwd.h> -#include <grp.h> #include "toys.h" #define FLAG_n (1<<4) @@ -36,8 +33,8 @@ config ID #define FLAG_r (1<<1) #define FLAG_u 1 -void -pretty_print(struct passwd *pw, struct group *grp, struct group **grps, int n) +void pretty_print(struct passwd *pw, struct group *grp, struct group **grps, + int n) { int i; printf("uid= %d(%s) gid= %d(%s)", pw->pw_uid, pw->pw_name, @@ -22,14 +22,6 @@ config LS -l show full details for each file */ -/* So that we can do 64-bit stat etc... */ -#define _FILE_OFFSET_BITS 64 - -#include <unistd.h> -#include <sys/types.h> -#include <grp.h> -#include <pwd.h> - #include "toys.h" #define FLAG_a 1 diff --git a/toys/sort.c b/toys/sort.c index fabff694..89a97026 100644 --- a/toys/sort.c +++ b/toys/sort.c @@ -61,7 +61,6 @@ config SORT_FLOAT */ #include "toys.h" -#include <math.h> DEFINE_GLOBALS( char *key_separator; diff --git a/toys/uname.c b/toys/uname.c index dd29ec17..185d633e 100644 --- a/toys/uname.c +++ b/toys/uname.c @@ -25,7 +25,6 @@ config UNAME */ #include "toys.h" -#include <sys/utsname.h> // If a 32 bit x86 build environment working in a chroot under an x86-64 // kernel returns x86_64 for -m it confuses ./configure. Special case it. diff --git a/toys/unshare.c b/toys/unshare.c index 6485e334..8257b7c8 100644 --- a/toys/unshare.c +++ b/toys/unshare.c @@ -27,8 +27,6 @@ config UNSHARE #include "toys.h" -#include <sched.h> - void unshare_main(void) { unsigned flags[]={CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET,0}; @@ -21,8 +21,6 @@ config WHO */ #include "toys.h" -#include <time.h> -#include <utmpx.h> void who_main(void) { |