source: trunk/WRF.COMMON/WRFV3/tools/fseek_test.c

Last change on this file was 2759, checked in by aslmd, 2 years ago

adding unmodified code from WRFV3.0.1.1, expurged from useless data +1M size

File size: 957 bytes
Line 
1#define _FILE_OFFSET_BITS 64
2#include <stdio.h>
3#include <stdlib.h>
4#include <errno.h>
5#include <sys/types.h>
6main()
7{
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 ;
41  }
42  fclose(fp) ;
43  exit(retval) ;
44}
45
Note: See TracBrowser for help on using the repository browser.