Diagnose bad times. Thanks to Uriel. [rsc] --rw-rw-r-- M 840072 glenda sys 960 Feb 12 10:28 sys/src/cmd/touch.c /n/sourcesdump/2006/0212/plan9/sys/src/cmd/touch.c:14,19 - /n/sourcesdump/2006/0213/plan9/sys/src/cmd/touch.c:14,20 void main(int argc, char **argv) { + char *t, *s; int nocreate = 0; int status = 0; /n/sourcesdump/2006/0212/plan9/sys/src/cmd/touch.c:20,26 - /n/sourcesdump/2006/0213/plan9/sys/src/cmd/touch.c:21,30 now = time(0); ARGBEGIN{ case 't': - now = strtoul(EARGF(usage()), 0, 0); + t = EARGF(usage()); + now = strtoul(t, &s, 0); + if(s == t || *s != '\0') + usage(); break; case 'c': nocreate = 1; /n/sourcesdump/2006/0212/plan9/sys/src/cmd/touch.c:51,57 - /n/sourcesdump/2006/0213/plan9/sys/src/cmd/touch.c:55,61 fprint(2, "touch: %s: cannot wstat: %r\n", name); return 1; } - if ((fd = create(name, OREAD|OEXCL, 0666)) < 0) { + if((fd = create(name, OREAD|OEXCL, 0666)) < 0){ fprint(2, "touch: %s: cannot create: %r\n", name); return 1; } [rsc] --rw-rw-r-- M 840072 glenda sys 960 Feb 12 10:28 sys/src/cmd/touch.c