1 /* Emulate getcwd using getwd.
2 This function is in the public domain. */
6 @deftypefn Supplemental char* getcwd (char *@var{pathname}, int @var{len})
8 Copy the absolute pathname for the current working directory into
9 @var{pathname}, which is assumed to point to a buffer of at least
10 @var{len} bytes, and return a pointer to the buffer. If the current
11 directory's path doesn't fit in @var{len} characters, the result is
12 @code{NULL} and @code{errno} is set. If @var{pathname} is a null pointer,
13 @code{getcwd} will obtain @var{len} bytes of space using
22 #ifdef HAVE_SYS_PARAM_H
23 #include <sys/param.h>
33 extern char *getwd ();
37 #define MAXPATHLEN 1024
45 char ourbuf
[MAXPATHLEN
];
48 result
= getwd (ourbuf
);
50 if (strlen (ourbuf
) >= len
) {
55 buf
= (char*)malloc(len
);
This page took 0.033747 seconds and 4 git commands to generate.