~ubuntu-branches/ubuntu/quantal/psicode/quantal

« back to all changes in this revision

Viewing changes to src/bin/psiclean/psiclean.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2009-02-23 00:12:02 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090223001202-rutldoy3dimfpesc
Tags: 3.4.0-1
* New upstream release.

[ Michael Banck ]
* debian/patches/01_DESTDIR.dpatch: Refreshed.
* debian/patches/02_FHS.dpatch: Removed, applied upstream.
* debian/patches/03_debian_docdir: Likewise.
* debian/patches/04_man.dpatch: Likewise.
* debian/patches/06_466828_fix_gcc_43_ftbfs.dpatch: Likewise.
* debian/patches/07_464867_move_executables: Fixed and refreshed.
* debian/patches/00list: Adjusted.
* debian/control: Improved description.
* debian/patches-held: Removed.
* debian/rules (install/psi3): Do not ship the ruby bindings for now.

[ Daniel Leidert ]
* debian/rules: Fix txtdir via DEB_MAKE_INSTALL_TARGET.
* debian/patches/01_DESTDIR.dpatch: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
** PSICLEAN
3
 
**
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
7
 
** instead.
8
 
**
9
 
** C. David Sherrill
10
 
** 
11
 
*/ 
12
 
 
13
 
#include <stdio.h>
14
 
#include <libipv1/ip_lib.h>
15
 
#include <libpsio/psio.h>
16
 
#include <libciomr/libciomr.h>
17
 
#include <libqt/qt.h>
18
 
 
19
 
 
20
 
FILE *infile, *outfile;
21
 
char *psi_file_prefix;
22
 
void exit_bad(void);
23
 
 
24
 
int main(int argc, char *argv[])
25
 
{
26
 
  ULI i, nvol;
27
 
  int errcod;
28
 
  char vpath[MAX_STRING];
29
 
  char basename[MAX_STRING];
30
 
  char fileslist[MAX_STRING];
31
 
  char cmdstring[MAX_STRING];
32
 
 
33
 
  psi_start(argc-1,argv+1,0);
34
 
  
35
 
  /* Initialize the I/O system */
36
 
  psio_init();
37
 
 
38
 
  /* Get the number of volumes */
39
 
  nvol = psio_get_numvols_default();
40
 
 
41
 
  errcod = psio_get_filename_default(basename);
42
 
 
43
 
  for (i=0; i<nvol; i++) {
44
 
    errcod = psio_get_volpath_default(i, vpath);
45
 
 
46
 
    /* errcod == 1 now means that the default of /tmp/ is used for volpath 
47
 
    **  -TDC, 8/03 */
48
 
    /*
49
 
    if (errcod) {
50
 
      fprintf(outfile, "psiclean: Trouble reading volume path %d\n", nvol);
51
 
      exit_bad();
52
 
    }
53
 
    */
54
 
 
55
 
    sprintf(fileslist,"%s%s.*",vpath,basename);
56
 
    sprintf(cmdstring,"echo Removing files %s%s",vpath,basename);
57
 
    system(cmdstring);
58
 
    sprintf(cmdstring,"ls -l %s",fileslist);
59
 
    system(cmdstring);
60
 
    sprintf(cmdstring,"/bin/rm %s",fileslist);
61
 
    system(cmdstring);
62
 
  }
63
 
 
64
 
  /* we're done, clean up */
65
 
  psio_done();
66
 
  psi_stop();
67
 
  exit(0);
68
 
}
69
 
 
70
 
 
71
 
void exit_bad(void)
72
 
{
73
 
  psio_done();
74
 
  exit(1);
75
 
}
76
 
 
77
 
 
78
 
char *gprgid()
79
 
{
80
 
   char *prgid = "PSICLEAN";
81
 
 
82
 
   return(prgid);
83
 
}
84
 
 
85