.TH GETWD 3 .CT 2 dirs .SH NAME getwd, getcwd \(mi get current directory .SH SYNOPSIS .B char *getwd(buf) .br .B char *buf; .PP .B char *getcwd(buf, size) .br .B char *buf; .SH DESCRIPTION .I Getwd and .I getcwd fill .I buf with a null-terminated string representing the current directory and return .IR buf . .PP .I Getwd is in the style of BSD systems and .I getcwd in that of System V. If .I buf is 0, .I getcwd will call .IR malloc (3) to allocate .I size bytes for the buffer. .SH "SEE ALSO .IR pwd (1) .SH DIAGNOSTICS On error, zero is returned and .I buf is filled with a diagnostic message.