Update release-README after completing the 2.43 release.
[binutils-gdb.git] / sim / testsuite / cris / c / openpf1.c
blob37940d709fbbac797de010a29d6c9a79e4382005
1 /* Check that --sysroot is applied to open(2).
2 #sim: --sysroot=$pwd
4 We assume, with EXE being the name of the executable:
5 - The simulator executes with cwd the same directory where the executable
6 is located (also argv[0] contains a plain filename without directory
7 components -or- argv[0] contains the full non-sysroot path to EXE).
8 - There's no /EXE on the host file system. */
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include <errno.h>
14 int main (int argc, char *argv[])
16 char *fnam = argv[0];
17 FILE *f;
18 if (argv[0][0] != '/')
20 fnam = malloc (strlen (argv[0]) + 2);
21 if (fnam == NULL)
22 abort ();
23 strcpy (fnam, "/");
24 strcat (fnam, argv[0]);
26 else
27 fnam = strrchr (argv[0], '/');
29 f = fopen (fnam, "rb");
30 if (f == NULL)
31 abort ();
32 fclose (f);
34 /* Cover another execution path. */
35 if (fopen ("/nonexistent", "rb") != NULL
36 || errno != ENOENT)
37 abort ();
38 printf ("pass\n");
39 return 0;