home *** CD-ROM | disk | FTP | other *** search
- h47496
- s 00000/00000/00047
- d D 1.3 95/07/05 20:12:55 tim 3 2
- c the input and output skeletons now make the numbering 3 digits
- e
- s 00008/00001/00039
- d D 1.2 95/07/05 13:40:35 tim 2 1
- c made it put an end on the out.mta file and terminate the dirs with a \
- e
- s 00040/00000/00000
- d D 1.1 95/07/04 20:12:10 tim 1 0
- c
- e
- u
- U
- f e 0
- t
- T
- I 1
- /* 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 ;
-
- I 2
- if (argc != 2)
- {
- fprintf(stderr, "Usage: complistfiles matafile\n") ;
- exit(1) ;
- }
- E 2
- llinit() ;
- /* load in the meta file */
- readmeta(argv[1], inlist) ;
-
- I 2
- count = 0 ;
-
- E 2
- /* shuffle the files down */
- for (i = 1; i <= inlist->count ; i ++)
- {
- /* get the ll entry we are dealing with */
- llptr = llnofind(i, inlist) ;
- D 2
- sprintf(fname, INSKELETON, i) ;
- E 2
- I 2
- sprintf(fname, INSKELETON, count) ;
- E 2
- 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) ;
- }
-
- E 1
-