Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <libc/stubs.h>
  3. #include <unistd.h>
  4. #include <stdlib.h>
  5. #include <errno.h>
  6. #include <libc/farptrgs.h>
  7. #include <libc/dosio.h>
  8.  
  9. static char * __cur_cwd;
  10.  
  11. extern char* __get_curdir(void);
  12. char * getcwd(char *buf, size_t size)
  13. {
  14. #ifndef min
  15. #define min(a,b) ((a)<(b)?(a):(b))
  16. #endif
  17.  size_t k;
  18.  __cur_cwd=__get_curdir();
  19.  k=min(size,strlen(__cur_cwd));
  20.  memcpy(buf,__cur_cwd,k+1);
  21.  return buf;
  22. }
  23.  
  24. void __libc_set_cwd(char * p)
  25. {
  26.  __chdir(p);
  27. }
  28.