_utime.c 539 B

1234567891011121314151617181920212223242526272829
  1. /* _utime(2) for POSIX Authors: Terrence W. Holm & Edwin L. Froese */
  2. #include <lib.h>
  3. #define time _time
  4. #include <time.h>
  5. #define utime _utime
  6. #include <utime.h>
  7. long time();
  8. PUBLIC int utime(name, timp)
  9. char *name;
  10. struct utimbuf *timp;
  11. {
  12. long current_time;
  13. if (timp == (struct utimbuf *)NULL) {
  14. current_time = time((long *)NULL);
  15. _M.m2_l1 = current_time;
  16. _M.m2_l2 = current_time;
  17. } else {
  18. _M.m2_l1 = timp->actime;
  19. _M.m2_l2 = timp->modtime;
  20. }
  21. _M.m2_i1 = _len(name);
  22. _M.m2_p1 = name;
  23. return _callx(FS, UTIME);
  24. }