/* * generate a list of files and their metadata * using a given proto file. */ #include "all.h" int changesonly; char *uid; Db *db; Biobuf blog; ulong now; int n; char **x; int nx; int justlog; char *root="."; char **match; int nmatch; int ismatch(char *s) { int i, len; if(nmatch == 0) return 1; for(i=0; iname; if(strcmp(dname, name) == 0) dname = "-"; if(!justlog) Bprint(&blog, "%lud %d ", now, n++); Bprint(&blog, "%c %q %q %luo %q %q %lud %lld\n", c, name, dname, d->mode, uid ? uid : d->uid, d->gid, d->mtime, d->length); } void walk(char *new, char *old, Dir *xd, void*) { int i, change, len; Dir od, d; new = unroot(new, "/"); old = unroot(old, root); if(!ismatch(new)) return; for(i=0; iavl); while(e = (Entry*)avlprev(w)){ if(!ismatch(e->name)) continue; if(!e->d.mark){ /* not visited during walk */ memset(&d, 0, sizeof d); d.name = e->d.name; d.uid = e->d.uid; d.gid = e->d.gid; d.mtime = e->d.mtime; d.mode = e->d.mode; xlog('d', e->name, &d); if(!justlog) removedb(db, e->name); } } } if(Bterm(&blog) < 0) sysfatal("writing output: %r"); exits(nil); }