summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cvs/vms/stat.c
blob: af3b5acc3af757d98bc2b43bb98e946a75a2b6b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <string.h>
#include <stat.h>
#include <unixlib.h>

int wrapped_stat (path, buffer)
const char *path;
struct stat *buffer;
{
  char statpath[1024];
  int rs;

  strcpy(statpath, path);
  strip_trailing_slashes (statpath);
  if(strcmp(statpath, ".") == 0)
     getwd(statpath);

  if ((rs = stat (statpath, buffer)) < 0)
      {
      /* If stat() fails try again after appending ".dir" to the filename
         this allows you to stat things like "bloogle/CVS" from VMS 6.1 */
      strcat(statpath, ".dir");
      rs = stat (statpath, buffer);
      }

  return rs;
}