Statistics
| Branch: | Revision:

root / tests / tcg / cris / check_stat3.c @ c09015dd

History | View | Annotate | Download (486 Bytes)

1 dd43edf4 ths
/* Simulator options:
2 dd43edf4 ths
#sim: --sysroot=@exedir@
3 dd43edf4 ths
*/
4 dd43edf4 ths
#include <sys/types.h>
5 dd43edf4 ths
#include <sys/stat.h>
6 dd43edf4 ths
#include <unistd.h>
7 dd43edf4 ths
#include <stdio.h>
8 dd43edf4 ths
#include <string.h>
9 dd43edf4 ths
#include <stdlib.h>
10 dd43edf4 ths
11 dd43edf4 ths
int main (int argc, char *argv[])
12 dd43edf4 ths
{
13 dd43edf4 ths
  char path[1024] = "/";
14 dd43edf4 ths
  struct stat buf;
15 dd43edf4 ths
16 2917dce4 Stefan Weil
  strncat(path, argv[0], sizeof(path) - 2);
17 dd43edf4 ths
  if (stat (".", &buf) != 0
18 dd43edf4 ths
      || !S_ISDIR (buf.st_mode))
19 dd43edf4 ths
    abort ();
20 dd43edf4 ths
  if (stat (path, &buf) != 0
21 dd43edf4 ths
      || !S_ISREG (buf.st_mode))
22 dd43edf4 ths
    abort ();
23 dd43edf4 ths
  printf ("pass\n");
24 dd43edf4 ths
  exit (0);
25 dd43edf4 ths
}