Update release-README after completing the 2.43 release.
[binutils-gdb.git] / sim / testsuite / cris / c / seek1.c
blobb22c8f9e9b1de48c9082ff0f5167cca032bd6786
1 /* Check that basic (ll|f)seek sim functionality works. Also uses basic
2 file open/write functionality. */
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
7 int
8 main (void)
10 FILE *f;
11 const char fname[] = "sk1test.dat";
12 const char tsttxt[]
13 = "A random line of text, used to test correct read, write and seek.\n";
14 char buf[sizeof tsttxt] = "";
16 f = fopen (fname, "w");
17 if (f == NULL
18 || fwrite (tsttxt, 1, strlen (tsttxt), f) != strlen (tsttxt)
19 || fclose (f) != 0)
21 printf ("fail\n");
22 exit (1);
25 /* Using "rb" to make this test similar to the use in genconf.c in
26 GhostScript. */
27 f = fopen (fname, "rb");
28 if (f == NULL
29 || fseek (f, 0L, SEEK_END) != 0
30 || ftell (f) != strlen (tsttxt))
32 printf ("fail\n");
33 exit (1);
36 rewind (f);
37 if (fread (buf, 1, strlen (tsttxt), f) != strlen (tsttxt)
38 || strcmp (buf, tsttxt) != 0
39 || fclose (f) != 0)
41 printf ("fail\n");
42 exit (1);
45 printf ("pass\n");
46 exit (0);