diff options
-rw-r--r-- | cleanup.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -24,6 +24,7 @@ #include <err.h> #include <errno.h> #include <math.h> +#include <string.h> #include <stdio.h> #include <time.h> #include <unistd.h> @@ -45,10 +46,11 @@ main(int argc, char * const argv[]) time_t curr_time = time(NULL); int verbose, dryrun, ch; + char* exclude = ""; verbose = 0; dryrun = 0; - while ((ch = getopt(argc, argv, "vn")) != -1) { + while ((ch = getopt(argc, argv, "vnx:")) != -1) { switch (ch) { case 'v': verbose = 1; @@ -56,6 +58,8 @@ main(int argc, char * const argv[]) case 'n': dryrun = 1; break; + case 'x': + exclude = optarg; } } argc -= optind; @@ -73,6 +77,8 @@ main(int argc, char * const argv[]) if (stat(node->fts_path, &attr) == -1) err(1, NULL); if (strcmp(node->fts_name, exclude) == 0) { + if (verbose) + printf("%s excluded\n", node->fts_path); break; } file_age = difftime(curr_time, attr.st_mtime) / 86400.0; |