Mail Archives: djgpp/1992/07/08/01:11:32
I pulled this out of DEMACS.
/* DJGCC's stat () can't get the status of root directory. */
/* We can't redefine stat () to sys_stat () because structure named stat
is declared in <sys/stat.h>. So we must rewite stat () to sys_stat ()
in all file it appears. */
int
sys_stat (name, buf)
char *name;
struct stat *buf;
{
extern int stat ();
if (strcmp (name, "/") && strcmp (name + 1, ":/"))
{
int len = strlen (name);
char *tmp = (char *) alloca (len + 1);
strcpy (tmp, name);
if (tmp[len - 1] == '/') tmp[len - 1] = 0;
return stat (tmp, buf);
}
else
{
buf->st_rdev = buf->st_ino = 0;
buf->st_dev = 0;
buf->st_nlink = 1;
buf->st_uid = buf->st_gid = 0;
buf->st_size = 0;
buf->st_atime = buf->st_mtime = buf->st_ctime = 0;
buf->st_mode = S_IREAD | S_IWRITE | S_IFDIR;
return 0;
}
}
- Raw text -