4
** Utility program to delete scratch files. Generalization of earlier
5
** PSI2.0 shell script which was limited to scratch files being put
6
** in /tmp[0-9]/$user/$name.* . Here we will search the default path
14
#include <libipv1/ip_lib.h>
15
#include <libpsio/psio.h>
16
#include <libciomr/libciomr.h>
20
FILE *infile, *outfile;
21
char *psi_file_prefix;
24
int main(int argc, char *argv[])
28
char vpath[MAX_STRING];
29
char basename[MAX_STRING];
30
char fileslist[MAX_STRING];
31
char cmdstring[MAX_STRING];
33
psi_start(argc-1,argv+1,0);
35
/* Initialize the I/O system */
38
/* Get the number of volumes */
39
nvol = psio_get_numvols_default();
41
errcod = psio_get_filename_default(basename);
43
for (i=0; i<nvol; i++) {
44
errcod = psio_get_volpath_default(i, vpath);
46
/* errcod == 1 now means that the default of /tmp/ is used for volpath
50
fprintf(outfile, "psiclean: Trouble reading volume path %d\n", nvol);
55
sprintf(fileslist,"%s%s.*",vpath,basename);
56
sprintf(cmdstring,"echo Removing files %s%s",vpath,basename);
58
sprintf(cmdstring,"ls -l %s",fileslist);
60
sprintf(cmdstring,"/bin/rm %s",fileslist);
64
/* we're done, clean up */
80
char *prgid = "PSICLEAN";