Change internal flag organization in CMake build to not be global (#2053)
[WRF.git] / tools / fseek_test.c
blobc1bee099b5a385581abd3add2b41fdc3f36df853
1 #define _FILE_OFFSET_BITS 64
2 #ifndef FILE_TO_TEST
3 #define FILE_TO_TEST "Makefile"
4 #endif
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <errno.h>
8 #include <sys/types.h>
9 main()
11 FILE *fp ;
12 long long y ;
13 int retval ;
14 int result1 ;
15 #ifdef TEST_FSEEKO
16 off_t x ;
17 off_t result2 ;
18 #endif
19 #ifdef TEST_FSEEKO64
20 long long x ;
21 int result2 ;
22 #endif
23 fp = NULL ;
24 fp = fopen( FILE_TO_TEST , "r" ) ;
25 #ifdef TEST_FSEEKO
26 x = 0xffffffff ;
27 result1 = (sizeof(x) == 8) ;
28 result2 = fseeko( fp, x, SEEK_SET ) ;
29 #endif
30 #ifdef TEST_FSEEKO64
31 x = 0xffffffffL ;
32 result1 = (sizeof(x) == 8) ;
33 result2 = fseeko64( fp, x, SEEK_SET ) ;
34 #endif
35 if ( result2 ) perror("error") ;
36 fprintf(stdout,"pointer is 8 bytes: %s\n",result1?"true":"false") ;
37 fprintf(stdout,"seek returns correctly: %s\n",!result2?"true":"false") ;
38 if ( result1 && !result2 ) {
39 fprintf(stdout,"status: OK\n") ;
40 retval = 0 ;
41 } else {
42 fprintf(stdout,"status: BUMMER\n") ;
43 retval = 1 ;
45 fclose(fp) ;
46 exit(retval) ;