# # initially generated by c2l # bulkmtime(dir: array of byte) { buf := array[4096] of byte; ss, s: array of byte; db: Sys->Dir; ok: int; if(dir != nil){ s = dir; if(libc0->strcmp(dir, libc0->s2ab("/")) == 0) libc0->strcpy(buf, dir); else stob(buf, sys->sprint("%s/", libc0->ab2s(dir))); (ok, db) = mkdirstat(dir); if(ok >= 0 && (db.qid.path&Sys->CHDIR) == 0){ # bugger off sys->fprint(sys->fildes(2), "mk: %s is not a directory path=%ux\n", libc0->ab2s(dir), db.qid.path); Exit(); } } else{ s = libc0->s2ab("."); buf[0] = byte 0; } if(symlooki(s, S_BULKED, 0) != nil) return; ss = libc0->strdup(s); symlooks(ss, S_BULKED, ss); dirtime(s, buf); } mtime(name: array of byte): int { sbuf: Sys->Dir; s, ss: array of byte; carry: byte; ok: int; s = libc0->strrchr(name, '/'); if(s == name) s = s[1: ]; if(s != nil){ ss = name; carry = s[0]; s[0] = byte 0; } else{ ss = nil; carry = byte 0; } bulkmtime(ss); if(int carry) s[0] = carry; (ok, sbuf) = mkdirstat(name); if(ok < 0) return 0; return sbuf.mtime; } filetime(name: array of byte): int { sym: ref Symtab; sym = symlooki(name, S_TIME, 0); if(sym != nil) return sym.ivalue; # uggh return mtime(name); }