Mercurial > hg > toybox
changeset 533:31215cc6c9f2
Consolidate headers.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 07 Mar 2012 19:04:50 -0600 |
parents | d44eb064da41 |
children | a864aa8c6331 |
files | lib/portability.h toys.h toys/dirname.c toys/id.c toys/ls.c toys/sort.c toys/uname.c toys/unshare.c toys/who.c |
diffstat | 9 files changed, 14 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/portability.h Wed Mar 07 19:00:21 2012 -0600 +++ b/lib/portability.h Wed Mar 07 19:04:50 2012 -0600 @@ -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__)
--- a/toys.h Wed Mar 07 19:00:21 2012 -0600 +++ b/toys.h Wed Mar 07 19:04:50 2012 -0600 @@ -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
--- a/toys/dirname.c Wed Mar 07 19:00:21 2012 -0600 +++ b/toys/dirname.c Wed Mar 07 19:04:50 2012 -0600 @@ -18,7 +18,6 @@ */ #include "toys.h" -#include <libgen.h> void dirname_main(void) {
--- a/toys/id.c Wed Mar 07 19:00:21 2012 -0600 +++ b/toys/id.c Wed Mar 07 19:04:50 2012 -0600 @@ -25,9 +25,6 @@ -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 @@ #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,
--- a/toys/ls.c Wed Mar 07 19:00:21 2012 -0600 +++ b/toys/ls.c Wed Mar 07 19:04:50 2012 -0600 @@ -22,14 +22,6 @@ -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
--- a/toys/sort.c Wed Mar 07 19:00:21 2012 -0600 +++ b/toys/sort.c Wed Mar 07 19:04:50 2012 -0600 @@ -61,7 +61,6 @@ */ #include "toys.h" -#include <math.h> DEFINE_GLOBALS( char *key_separator;
--- a/toys/uname.c Wed Mar 07 19:00:21 2012 -0600 +++ b/toys/uname.c Wed Mar 07 19:04:50 2012 -0600 @@ -25,7 +25,6 @@ */ #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.