Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getcwd(3C) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

malloc(3C)

popen(3S)

pwd(1)




getcwd(3C) getcwd(3C)
NAME getcwd - gets the pathname of the current working directory SYNOPSIS char *getcwd(buf, size) char *buf; int size; DESCRIPTION getcwd returns a pointer to the current directory pathname. The value of size must be at least two greater than the length of the pathname to be returned. If buf is a null pointer, getcwd obtains size bytes of space by using malloc(3C). In this case, the pointer returned by getcwd may be used as the argument in a subsequent call to free. The function is implemented by using popen(3S) to pipe the output of the pwd(1) command into the specified string space. EXAMPLES #include <limits.h> char *cwd, *getcwd(); . . . if ((cwd=getcwd((char *)NULL, PATH-MAX))==NULL) { perror(``pwd''); exit(1); } printf("%s\n", cwd); STATUS MESSAGES AND VALUES If any of the following conditions occur, getcwd returns NULL and sets errno to the corresponding value: EINVAL The size is less than or equal to 0. ERANGE The size is not large enough to contain the pathname. EACCES The read or search permission was denied for a component of the pathname. The getcwd command will fail if one or more of the following are true: January 1992 1



getcwd(3C) getcwd(3C)
EINVAL The size is less than or equal to 0. ERANGE The size is not large enough to contain the pathname. EACCES The read or search permission was denied for a component of the pathname. SEE ALSO malloc(3C), popen(3S) pwd(1) in A/UX Command Reference 2 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026