Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (512 Bytes)

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