Dash:
[t2.git] / architecture / share / archtest.c
blobfb96327717e7c46ff903b3df2f488422c48a21da
1 /*
2 * --- T2-COPYRIGHT-NOTE-BEGIN ---
3 * This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 *
5 * T2 SDE: architecture/share/archtest.c
6 * Copyright (C) 2004 - 2005 The T2 SDE Project
7 *
8 * More information can be found in the files COPYING and README.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; version 2 of the License. A copy of the
13 * GNU General Public License can be found in the file COPYING.
14 * --- T2-COPYRIGHT-NOTE-END ---
16 #include <stdio.h>
18 char * isbigendian () {
19 /* Are we little or big endian? From Harbison&Steele. */
20 union { long l; char c[sizeof (long)]; } u;
21 u.l=1; return (u.c[0] == 1)?"no":"yes";
24 int main() {
25 printf("arch_sizeof_short=%d\n",sizeof(short));
26 printf("arch_sizeof_int=%d\n",sizeof(int));
27 printf("arch_sizeof_long=%d\n",sizeof(long));
28 printf("arch_sizeof_long_long=%d\n",sizeof(long long));
29 printf("arch_sizeof_char_p=%d\n",sizeof(char *));
30 printf("arch_bigendian=%s\n",isbigendian());
31 printf("arch_machine="); fflush(stdout); system("uname -m");
32 system("echo arch_target=`uname -m -p | tr ' ' -`-linux");
33 return 0;