1 /* Simulator options: 2 #sim: --sysroot=$pwd 3 */ 4 #include <sys/types.h> 5 #include <sys/stat.h> 6 #include <unistd.h> 7 #include <stdio.h> 8 #include <string.h> 9 #include <stdlib.h> 10 main(int argc,char * argv[])11int main (int argc, char *argv[]) 12 { 13 /* Pick a regular file we know will always be in the sim builddir. */ 14 char path[1024] = "/Makefile"; 15 struct stat buf; 16 17 if (stat (".", &buf) != 0 18 || !S_ISDIR (buf.st_mode)) 19 { 20 fprintf (stderr, "cwd is not a directory\n"); 21 return 1; 22 } 23 if (stat (path, &buf) != 0 24 || !S_ISREG (buf.st_mode)) 25 { 26 fprintf (stderr, "%s: is not a regular file\n", path); 27 return 1; 28 } 29 printf ("pass\n"); 30 exit (0); 31 } 32