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