pwd.c 287 B

12345678910111213141516171819
  1. #include <u.h>
  2. #include <libc.h>
  3. /*
  4. * Print working (current) directory
  5. */
  6. void
  7. main(int argc, char *argv[])
  8. {
  9. char pathname[512];
  10. USED(argc, argv);
  11. if(getwd(pathname, sizeof(pathname)) == 0) {
  12. fprint(2, "pwd: %r\n");
  13. exits("getwd");
  14. }
  15. print("%s\n", pathname);
  16. exits(0);
  17. }