/** F77 NOTE: the getcwd() routine should be in libc.a ! **/
* return name of working (current) directory
static char slash
[] = "/";
static char dotdot
[] = "..";
char *namep
= &name
[(sizeof name
)-1];
if (d
.st_ino
== rino
&& d
.st_dev
== rdev
)
if (*namep
== '\0') /* rootdir is a special case */
namep
= prepend(namep
, slash
);
if ((fd
= open(dotdot
,0)) < 0)
chdir(prepend(namep
, dot
));
if(d
.st_dev
== dd
.st_dev
)
if(d
.st_ino
== dd
.st_ino
)
if (*namep
== '\0') /* root is a special case */
namep
= prepend(namep
, slash
);
if (read(fd
, (char *)&dir
, sizeof(dir
)) < sizeof(dir
))
chdir(prepend(namep
, dot
));
} while (dir
.d_ino
!= d
.st_ino
);
if(read(fd
, (char *)&dir
, sizeof(dir
)) < sizeof(dir
))
chdir(prepend(namep
, dot
));
} while(dd
.st_ino
!= d
.st_ino
|| dd
.st_dev
!= d
.st_dev
);
namep
= prepend(prepend(namep
, dir
.d_name
), slash
);
char id_getcwd[] = "@(#)getcwd_.c 1.3";
* Get pathname of current working directory.
* path will receive the pathname of the current working directory.
* ierr will be 0 if successful, a system error code otherwise.