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