Adds usage diag. to du, and option -m, to find files newer than a given time. This depends on the fossil patch to enable the mtime propagation. The man page also rewrites the synopsis in a more compact way. Reference: /n/sources/patch/saved/du Date: Sun Feb 24 00:53:38 CET 2008 --- /sys/src/cmd/du.c Sun Feb 24 00:53:38 2008 +++ /sys/src/cmd/du.c Sun Feb 24 00:53:38 2008 @@ -15,10 +15,18 @@ int tflag; int uflag; int qflag; +ulong mtime; char *fmt = "%llud\t%q\n"; vlong blocksize = 1024LL; void +usage(void) +{ + fprint(2, "usage: %s [-asfntuq] [-m time] [-b bsz] [file...]\n", argv0); + exits("usage"); +} + +void main(int argc, char *argv[]) { int i; @@ -37,6 +45,12 @@ case 'f': /* ignore errors */ fflag = 1; break; + case 'm': /* all files, modified after time */ + aflag = 1; + s = EARGF(usage()); + if (s) + mtime = strtoul(s, nil, 10); + break; case 'n': /* all files, number of bytes */ aflag = 1; nflag = 1; @@ -52,7 +66,7 @@ qflag = 1; break; case 'b': /* block size */ - s = ARGF(); + s = EARGF(usage()); if(s) { blocksize = strtoul(s, &ss, 0); if(s == ss) @@ -61,6 +75,8 @@ blocksize *= 1024; } break; + default: + usage(); } ARGEND if(argc==0) print(fmt, du(".", dirstat(".")), "."); @@ -95,7 +111,8 @@ if((d->qid.type&QTDIR) == 0) { t = k(d->length); nk += t; - if(aflag) { + if(aflag) + if(!mtime || d->mtime >= mtime){ file = s_copy(name); s_append(file, "/"); s_append(file, d->name); @@ -114,6 +131,8 @@ if(strcmp(d->name, ".") == 0 || strcmp(d->name, "..") == 0 || seen(d)) + continue; + if (mtime && d->mtime < mtime) continue; file = s_copy(name); s_append(file, "/"); --- /sys/man/1/du Sun Feb 24 00:53:38 2008 +++ /sys/man/1/du Sun Feb 24 00:53:38 2008 @@ -4,25 +4,10 @@ .SH SYNOPSIS .B du [ -.B -a +.B -asfntuq ] [ -.B -f -] -[ -.B -n -] -[ -.B -q -] -[ -.B -s -] -[ -.B -t -] -[ -.B -u +.B -m time ] [ .BI -b size @@ -85,6 +70,12 @@ .BR -n , the QID of each file rather than the size. +.PP +The +.B -m +option instructs +.I du +to ignore any file with modified time less than the one given. .PP Finally, the .B -s