Changeset 35878
- Timestamp:
- Aug 2, 2013, 11:12:17 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130711/Ohana/src/opihi/dvo/hosts.c
r35757 r35878 12 12 gprint (GP_ERR, " commands:\n"); 13 13 gprint (GP_ERR, " purge-temp : delete all tempfiles for this shell\n"); 14 gprint (GP_ERR, " : [-old-pid] [-all-pid] [-v] [-verbose] [-commit] [-type type] \n");14 gprint (GP_ERR, " : [-old-pid] [-all-pid] [-v] [-verbose] [-commit] [-type type] [-age hours]\n"); 15 15 gprint (GP_ERR, " get-results : determine name of RESULTS file\n"); 16 16 return FALSE; … … 33 33 } 34 34 35 struct timeval now; 36 gettimeofday (&now, NULL); 37 38 float AGE = 0; 39 int NOW = now.tv_sec; 40 if ((N = get_argument (argc, argv, "-age"))) { 41 remove_argument (N, &argc, argv); 42 AGE = atof(argv[N]); 43 remove_argument (N, &argc, argv); 44 } 45 35 46 int VERBOSE = FALSE; 36 47 if ((N = get_argument (argc, argv, "-v"))) { … … 121 132 glob (name, 0, NULL, &pglob); 122 133 int j; 134 struct stat filestats; 123 135 for (j = 0; j < pglob.gl_pathc; j++) { 136 if (AGE > 0) { 137 if (stat(pglob.gl_pathv[j], &filestats)) { 138 gprint (GP_ERR, "failed to get stats for %s\n", pglob.gl_pathv[j]); 139 continue; 140 } 141 float myAge = (NOW - filestats.st_mtime) / 3600.0; 142 if (myAge < AGE) continue; 143 } 124 144 if (VERBOSE) gprint (GP_ERR, "unlink %s\n", pglob.gl_pathv[j]); 125 145 if (!DRYRUN) unlink (pglob.gl_pathv[j]);
Note:
See TracChangeset
for help on using the changeset viewer.
