1 #include <string.h> 2 #include <stat.h> 3 #include <unixlib.h> 4 5 int wrapped_stat (path, buffer) 6 const char *path; 7 struct stat *buffer; 8 { 9 char statpath[1024]; 10 int rs; 11 12 strcpy(statpath, path); 13 strip_trailing_slashes (statpath); 14 if(strcmp(statpath, ".") == 0) 15 { 16 char *wd; 17 wd = xgetwd (); 18 rs = stat (wd, buffer); 19 free (wd); 20 } 21 else 22 rs = stat (statpath, buffer); 23 24 if (rs < 0) 25 { 26 /* If stat() fails try again after appending ".dir" to the filename 27 this allows you to stat things like "bloogle/CVS" from VMS 6.1 */ 28 strcat(statpath, ".dir"); 29 rs = stat (statpath, buffer); 30 } 31 32 return rs; 33 } 34