home *** CD-ROM | disk | FTP | other *** search
- /* shuffle the list of files in a meta file (in argv[1]) down so they are all
- numbered concurrentley sod all error handling in here though
- print the number of files operated on on the standard output for future use */
- #include "project.h"
- #include <string.h>
- #include <stdio.h>
- extern struct ll * inlist ;
- main(argc, argv)
- int argc ;
- char * argv[] ;
- {
- char fname[100] , tmp[1024] ;
- int i, count ;
- struct ll *llptr ;
-
- if (argc != 2)
- {
- fprintf(stderr, "Usage: complistfiles matafile\n") ;
- exit(1) ;
- }
- llinit() ;
- /* load in the meta file */
- readmeta(argv[1], inlist) ;
-
- count = 0 ;
-
- /* shuffle the files down */
- for (i = 1; i <= inlist->count ; i ++)
- {
- /* get the ll entry we are dealing with */
- llptr = llnofind(i, inlist) ;
- sprintf(fname, INSKELETON, count) ;
- if (strcmp(fname, llptr->datafile) == 0)
- {
- count ++ ;
- continue ;
- }
- sprintf(tmp, "mv %s %s", llptr->datafile, fname) ;
- system(tmp) ;
- count ++ ;
- }
- /* free the linked list */
- llfree(inlist) ;
- /* note the meta file will be rebuilt anyway so ignore it */
- printf("%d", count) ;
- }
-
-