From: Karel Zak Date: Tue, 20 Jan 2009 12:18:22 +0000 (+0100) Subject: tests: add "byte-order" to helpers/test_sysinfo X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f943449548a81bb5c22c9ae29dcc8236d1a5ad3;p=util-linux tests: add "byte-order" to helpers/test_sysinfo Signed-off-by: Karel Zak --- diff --git a/tests/helpers/test_sysinfo.c b/tests/helpers/test_sysinfo.c index 4b71955c..8ce1fe72 100644 --- a/tests/helpers/test_sysinfo.c +++ b/tests/helpers/test_sysinfo.c @@ -18,9 +18,13 @@ #include #include #include - +#include #include +#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN) +#error missing __BYTE_ORDER +#endif + typedef struct { const char *name; int (*fnc)(void); @@ -33,6 +37,18 @@ hlp_wordsize(void) return 0; } +int +hlp_endianness(void) +{ +#if (__BYTE_ORDER == __LITTLE_ENDIAN) + printf("LE\n"); +#else + printf("BE\n"); +#endif + return 0; +} + + int hlp_pagesize(void) { @@ -88,6 +104,7 @@ mntHlpfnc hlps[] = { "LONG_MAX", hlp_long_max }, { "ULONG_MAX", hlp_ulong_max }, { "ULONG_MAX32",hlp_ulong_max32 }, + { "byte-order", hlp_endianness }, { NULL, NULL } };