mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-03 10:49:58 +00:00
21 lines
286 B
C
21 lines
286 B
C
|
#include <string.h>
|
||
|
#include <unistd.h>
|
||
|
#include <errno.h>
|
||
|
|
||
|
char *
|
||
|
getwd (char *buf)
|
||
|
{
|
||
|
char tmp[MAXPATHLEN];
|
||
|
|
||
|
if (buf == NULL)
|
||
|
{
|
||
|
errno = EINVAL;
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
if (getcwd (tmp, MAXPATHLEN) == NULL)
|
||
|
return NULL;
|
||
|
|
||
|
return strncpy (buf, tmp, MAXPATHLEN);
|
||
|
}
|