2 * Copyright (C) 2007 Karel Zak <kzak@redhat.com>
4 * This file is part of util-linux-ng.
6 * This file is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This file is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
24 #if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN)
25 #error missing __BYTE_ORDER
36 printf("%d\n", __WORDSIZE);
43 #if (__BYTE_ORDER == __LITTLE_ENDIAN)
55 printf("%d\n", getpagesize());
62 printf("%d\n", INT_MAX);
69 printf("%u\n", UINT_MAX);
76 printf("%ld\n", LONG_MAX);
83 printf("%lu\n", ULONG_MAX);
91 printf("%lu\n", ULONG_MAX >> 32);
93 printf("%lu\n", ULONG_MAX);
100 { "WORDSIZE", hlp_wordsize },
101 { "pagesize", hlp_pagesize },
102 { "INT_MAX", hlp_int_max },
103 { "UINT_MAX", hlp_uint_max },
104 { "LONG_MAX", hlp_long_max },
105 { "ULONG_MAX", hlp_ulong_max },
106 { "ULONG_MAX32",hlp_ulong_max32 },
107 { "byte-order", hlp_endianness },
112 main(int argc, char **argv)
118 for (fn = hlps; fn->name; fn++) {
119 printf("%15s: ", fn->name);
125 if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0) {
126 printf("%s <option>\n", argv[0]);
127 fputs("options:\n", stdout);
128 for (fn = hlps; fn->name; fn++)
129 printf("\t%s\n", fn->name);
133 for (i=1; i < argc; i++) {
134 for (fn = hlps; fn->name; fn++) {
135 if (strcmp(fn->name, argv[i]) == 0)
141 exit(re ? EXIT_FAILURE : EXIT_SUCCESS);