From f05f660d9c4f18aa4702d723ed7b35f7053ce08c Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 7 Mar 2012 19:04:50 -0600 Subject: [PATCH] Consolidate headers. --- lib/portability.h | 9 +++++++-- toys.h | 5 +++++ toys/dirname.c | 1 - toys/id.c | 7 ++----- toys/ls.c | 8 -------- toys/sort.c | 1 - toys/uname.c | 1 - toys/unshare.c | 2 -- toys/who.c | 2 -- 9 files changed, 14 insertions(+), 22 deletions(-) diff --git a/lib/portability.h b/lib/portability.h index d4edfb6..0887d87 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 #define fdprintf(...) dprintf(__VA_ARGS__) diff --git a/toys.h b/toys.h index 504e0dc..f4ef2ef 100644 --- a/toys.h +++ b/toys.h @@ -15,8 +15,11 @@ #include #include #include +#include +#include #include #include +#include #include #include #include @@ -31,9 +34,11 @@ #include #include #include +#include #include #include #include +#include #undef _XOPEN_SOURCE #define _XOPEN_SOURCE 600 diff --git a/toys/dirname.c b/toys/dirname.c index bac0fd4..5dc6018 100644 --- a/toys/dirname.c +++ b/toys/dirname.c @@ -18,7 +18,6 @@ config DIRNAME */ #include "toys.h" -#include void dirname_main(void) { diff --git a/toys/id.c b/toys/id.c index 6ae3efe..aaea3e3 100644 --- a/toys/id.c +++ b/toys/id.c @@ -25,9 +25,6 @@ config ID -u Show only the effective user ID */ -#include -#include -#include #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, diff --git a/toys/ls.c b/toys/ls.c index 7610920..ec5606f 100644 --- a/toys/ls.c +++ b/toys/ls.c @@ -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 -#include -#include -#include - #include "toys.h" #define FLAG_a 1 diff --git a/toys/sort.c b/toys/sort.c index fabff69..89a9702 100644 --- a/toys/sort.c +++ b/toys/sort.c @@ -61,7 +61,6 @@ config SORT_FLOAT */ #include "toys.h" -#include DEFINE_GLOBALS( char *key_separator; diff --git a/toys/uname.c b/toys/uname.c index dd29ec1..185d633 100644 --- a/toys/uname.c +++ b/toys/uname.c @@ -25,7 +25,6 @@ config UNAME */ #include "toys.h" -#include // 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 6485e33..8257b7c 100644 --- a/toys/unshare.c +++ b/toys/unshare.c @@ -27,8 +27,6 @@ config UNSHARE #include "toys.h" -#include - void unshare_main(void) { unsigned flags[]={CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET,0}; diff --git a/toys/who.c b/toys/who.c index f6559bc..d407c6b 100644 --- a/toys/who.c +++ b/toys/who.c @@ -21,8 +21,6 @@ config WHO */ #include "toys.h" -#include -#include void who_main(void) { -- 2.7.4