getwd 701 B

12345678910111213141516171819202122232425262728293031323334353637
  1. .TH GETWD 2
  2. .SH NAME
  3. getwd \- get current directory
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .B
  10. char* getwd(char *buf, int size)
  11. .SH DESCRIPTION
  12. .I Getwd
  13. fills
  14. .I buf
  15. with a null-terminated string representing the current directory
  16. and returns
  17. .IR buf .
  18. .PP
  19. .I Getwd
  20. places no more than
  21. .I size
  22. bytes in the buffer provided.
  23. .SH SOURCE
  24. .B /sys/src/libc/9sys/getwd.c
  25. .SH "SEE ALSO"
  26. .IR pwd (1),
  27. .IR fd2path (2)
  28. .SH DIAGNOSTICS
  29. On error, zero is returned.
  30. .IR Errstr (2)
  31. may be consulted for more information.
  32. .SH BUGS
  33. Although the name returned by
  34. .I getwd
  35. is guaranteed to be the path used to reach the directory,
  36. if the name space has changed underfoot, the name may be
  37. incorrect.