From 7bea690e43ee009efc9e8f6a45504496348cd3ee Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Sat, 25 Jul 2015 14:44:54 +0200 Subject: Imported Upstream version 0.28.0 --- builtins/endianness | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 builtins/endianness (limited to 'builtins/endianness') diff --git a/builtins/endianness b/builtins/endianness new file mode 100755 index 0000000..fb7d76e --- /dev/null +++ b/builtins/endianness @@ -0,0 +1,62 @@ +#!/bin/sh + +############################################################ +# Copyright (c) 2009 by Aleksey Cheusov +# +# See LICENSE file in the distribution. +############################################################ + +set -e + +LC_ALL=C +export LC_ALL + +################################################## + +pathpart=endianness +. mkc_check_common.sh + +trap "rm -f $tmpc $tmpo" 0 + +CFLAGS="$CFLAGS -D_GNU_SOURCE -D_ALL_SOURCE" + +check_me (){ + cat > "$tmpc" </dev/null; then + return 0 + else + return 1 + fi +} + +if check_me BYTE_ORDER LITTLE_ENDIAN ' +#include +#include +'; +then + echo little + exit 0 +fi + +if check_me BYTE_ORDER BIG_ENDIAN ' +#include +#include +'; +then + echo big + exit 0 +fi + +echo unknown +exit 0 -- cgit v1.2.3