diff --git a/lib/roken/getcwd.c b/lib/roken/getcwd.c new file mode 100644 index 000000000..4053bdaa0 --- /dev/null +++ b/lib/roken/getcwd.c @@ -0,0 +1,17 @@ +#ifdef HAVE_CONFIG_H +#include +RCSID("$Id$"); +#endif + +#include + +char* +getcwd(char *path, int size) +{ + char xxx[MAXPATHLEN]; + char *ret; + ret = getwd(xxx); + if(ret) + strncpy(path, xxx, size); + return ret; +} diff --git a/lib/roken/roken.h b/lib/roken/roken.h index c9286cb5e..a698363f5 100644 --- a/lib/roken/roken.h +++ b/lib/roken/roken.h @@ -47,4 +47,8 @@ int inet_aton(char *cp, struct in_addr *adr); #endif #endif +#if !defined(HAVE_GETCWD) || defined(BROKEN_GETCWD) +char* getcwd(char *path, int size) +#endif + #endif /* __ROKEN_H__ */ diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index c9286cb5e..a698363f5 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -47,4 +47,8 @@ int inet_aton(char *cp, struct in_addr *adr); #endif #endif +#if !defined(HAVE_GETCWD) || defined(BROKEN_GETCWD) +char* getcwd(char *path, int size) +#endif + #endif /* __ROKEN_H__ */