11 void usage(char *prog)
13 printf("usage: %s filenamefmt count\n", prog);
14 printf(" %s filenamefmt start count\n", prog);
17 int main(int argc, char ** argv)
20 char format[4096], *fmt;
23 long begin = 0, count;
25 if (argc < 3 || argc > 4) {
30 if (strlen(argv[1]) > 4080) {
31 printf("name too long\n");
35 start = last = time(0);
38 count = strtol(argv[2], NULL, 0);
40 printf("count must be at least one\n");
44 begin = strtol(argv[2], NULL, 0);
45 count = strtol(argv[3], NULL, 0);
48 if (strchr(argv[1], '%')) {
51 sprintf(format, "%s%%d", argv[1]);
54 for (i = 0; i < count; i++, begin++) {
55 sprintf(filename, fmt, begin);
56 rc = unlink(filename);
58 printf("unlink(%s) error: %s\n",
59 filename, strerror(errno));
63 if ((i % 10000) == 0) {
64 printf(" - unlinked %d (time %ld ; total %ld ; last "
65 "%ld)\n", i, time(0), time(0) - start,
70 printf("total: %d unlinks in %ld seconds: %f unlinks/second\n", i,
71 time(0) - start, ((float)i / (time(0) - start)));