.TH GETWD 2 .SH NAME getwd \- get current directory .SH SYNOPSIS .B #include .br .B #include .PP .B char* getwd(char *buf, int size) .SH DESCRIPTION .I Getwd fills .I buf with a null-terminated string representing the current directory and returns .IR buf . .PP .I Getwd places no more than .I size bytes in the buffer provided. .SH SOURCE .B /sys/src/libc/9sys/getwd.c .SH "SEE ALSO" .IR pwd (1) .SH DIAGNOSTICS On error, zero is returned and .I buf is filled with a diagnostic message. .IR Errstr (2) may be consulted for more information. .SH BUGS Because mounts and binds (see .IR bind (2)) may produce multiple names for a directory, .I getwd might not return the path by which the directory was reached.