xref: /netbsd-src/external/gpl3/gdb/dist/sim/testsuite/cris/c/stat4.c (revision 4b169a6ba595ae283ca507b26b15fdff40495b1c)
1*4b169a6bSchristos /* Simulator options:
2*4b169a6bSchristos #progos: linux
3*4b169a6bSchristos #sim: --sysroot=$pwd
4*4b169a6bSchristos */
5*4b169a6bSchristos 
6*4b169a6bSchristos #include <sys/types.h>
7*4b169a6bSchristos #include <sys/stat.h>
8*4b169a6bSchristos #include <unistd.h>
9*4b169a6bSchristos #include <stdio.h>
10*4b169a6bSchristos #include <string.h>
11*4b169a6bSchristos #include <stdlib.h>
12*4b169a6bSchristos 
main(int argc,char * argv[])13*4b169a6bSchristos int main (int argc, char *argv[])
14*4b169a6bSchristos {
15*4b169a6bSchristos   char path[1024] = "/";
16*4b169a6bSchristos   struct stat buf;
17*4b169a6bSchristos 
18*4b169a6bSchristos   strcat (path, argv[0]);
19*4b169a6bSchristos   if (lstat (".", &buf) != 0
20*4b169a6bSchristos       || !S_ISDIR (buf.st_mode))
21*4b169a6bSchristos     abort ();
22*4b169a6bSchristos   if (lstat (path, &buf) != 0
23*4b169a6bSchristos       || !S_ISREG (buf.st_mode))
24*4b169a6bSchristos     abort ();
25*4b169a6bSchristos   printf ("pass\n");
26*4b169a6bSchristos   exit (0);
27*4b169a6bSchristos }
28*4b169a6bSchristos 
29