--- getcwd.c 2004-02-20 19:10:26.000000000 -0600 +++ void_pwd.c 2004-02-20 19:16:53.000000000 -0600 @@ -34,6 +34,8 @@ # include "config.h" #endif +#include +#include #include #include #include @@ -207,7 +209,7 @@ unless SIZE == 0, in which case it is as big as necessary. */ GETCWD_RETURN_TYPE -__getcwd (buf, size) +void_getcwd (buf, size) char *buf; size_t size; { @@ -249,12 +251,12 @@ pathp = path + allocated; *--pathp = '\0'; - if (__lstat (".", &st) < 0) + if (lstat (".", &st) < 0) goto lose2; thisdev = st.st_dev; thisino = st.st_ino; - if (__lstat ("/", &st) < 0) + if (lstat ("/", &st) < 0) goto lose2; rootdev = st.st_dev; rootino = st.st_ino; @@ -305,20 +307,20 @@ dotp -= 3; /* Figure out if this directory is a mount point. */ - if (__lstat (dotp, &st) < 0) + if (lstat (dotp, &st) < 0) goto lose; dotdev = st.st_dev; dotino = st.st_ino; mount_point = dotdev != thisdev; /* Search for the last directory. */ - dirstream = __opendir (dotp); + dirstream = opendir (dotp); if (dirstream == NULL) goto lose; /* Clear errno to distinguish EOF from error if readdir returns NULL. */ __set_errno (0); - while ((d = __readdir (dirstream)) != NULL) + while ((d = readdir (dirstream)) != NULL) { if (d->d_name[0] == '.' && (d->d_name[1] == '\0' || @@ -341,7 +343,7 @@ entry is in fact the one we are looking for we will find out soon as we reach the end of the directory without having found anything. */ - if (__lstat (name, &st) >= 0 + if (lstat (name, &st) >= 0 && st.st_dev == thisdev && st.st_ino == thisino) break; } @@ -349,7 +351,7 @@ if (d == NULL) { int save = errno; - (void) __closedir (dirstream); + (void) closedir (dirstream); if (save == 0) /* EOF on dirstream, which means that the current directory has been removed. */ @@ -365,7 +367,7 @@ { if (size != 0) { - (void) __closedir (dirstream); + (void) closedir (dirstream); __set_errno (ERANGE); goto lose; } @@ -378,7 +380,7 @@ tmp = realloc (path, allocated); if (tmp == NULL) { - (void) __closedir (dirstream); + (void) closedir (dirstream); __set_errno (ENOMEM);/* closedir might have changed it.*/ goto lose; } @@ -394,7 +396,7 @@ pathp -= namlen; (void) memcpy (pathp, d->d_name, namlen); *--pathp = '/'; - (void) __closedir (dirstream); + (void) closedir (dirstream); } thisdev = dotdev; @@ -426,3 +428,8 @@ #if defined _LIBC && !defined __getcwd weak_alias (__getcwd, getcwd) #endif + +int main() { + printf("%s\n",void_getcwd()); + return 0; +}