]>
gcc.gnu.org Git - gcc.git/blob - libiberty/getcwd.c
1 /* Emulate getcwd using getwd.
2 This function is in the public domain. */
6 getcwd -- get absolute pathname for current working directory
9 char *getcwd (char pathname[len], len)
12 Copy the absolute pathname for the current working directory into
13 the supplied buffer and return a pointer to the buffer. If the
14 current directory's path doesn't fit in LEN characters, the result
15 is NULL and errno is set.
18 Emulated via the getwd() call, which is reasonable for most
19 systems that do not have getcwd().
25 #ifdef HAVE_SYS_PARAM_H
26 #include <sys/param.h>
30 extern char *getwd ();
34 #define MAXPATHLEN 1024
42 char ourbuf
[MAXPATHLEN
];
45 result
= getwd (ourbuf
);
47 if (strlen (ourbuf
) >= len
) {
This page took 0.045642 seconds and 6 git commands to generate.