diff options
Diffstat (limited to 'gnu/usr.bin/groff/libgroff/getcwd.c')
-rw-r--r-- | gnu/usr.bin/groff/libgroff/getcwd.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/gnu/usr.bin/groff/libgroff/getcwd.c b/gnu/usr.bin/groff/libgroff/getcwd.c deleted file mode 100644 index 208e811..0000000 --- a/gnu/usr.bin/groff/libgroff/getcwd.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Partial emulation of getcwd in terms of getwd. */ - -#include <sys/param.h> -#include <string.h> -#include <errno.h> -#ifndef errno -extern int errno; -#endif - -char *getwd(); - -char *getcwd(buf, size) - char *buf; - int size; /* POSIX says this should be size_t */ -{ - if (size <= 0) { - errno = EINVAL; - return 0; - } - else { - char mybuf[MAXPATHLEN]; - int saved_errno = errno; - - errno = 0; - if (!getwd(mybuf)) { - if (errno == 0) - ; /* what to do? */ - return 0; - } - errno = saved_errno; - if (strlen(mybuf) + 1 > size) { - errno = ERANGE; - return 0; - } - strcpy(buf, mybuf); - return buf; - } -} |