home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / COMMS / PSIONMAI / PMFULLSO / SUNMAIL / SCCS / S1.C < prev    next >
Encoding:
Text File  |  1995-07-05  |  1.5 KB  |  77 lines

  1. h47496
  2. s 00000/00000/00047
  3. d D 1.3 95/07/05 20:12:55 tim 3 2
  4. c the input and output skeletons now make the numbering 3 digits
  5. e
  6. s 00008/00001/00039
  7. d D 1.2 95/07/05 13:40:35 tim 2 1
  8. c made it put an end on the out.mta file and terminate the dirs with a \
  9. e
  10. s 00040/00000/00000
  11. d D 1.1 95/07/04 20:12:10 tim 1 0
  12. c 
  13. e
  14. u
  15. U
  16. f e 0
  17. t
  18. T
  19. I 1
  20. /* shuffle the list of files in a meta file (in argv[1]) down so they are all
  21.    numbered concurrentley sod all error handling in here though
  22.    print the number of files operated on on the standard output for future use */
  23. #include "project.h"
  24. #include <string.h>
  25. #include <stdio.h>
  26. extern struct ll * inlist ;
  27. main(argc, argv)
  28. int argc ;
  29. char * argv[] ;
  30. {
  31.     char fname[100] , tmp[1024] ;
  32.     int i, count ;
  33.     struct ll *llptr ;
  34.  
  35. I 2
  36.     if (argc != 2)
  37.     {
  38.         fprintf(stderr, "Usage: complistfiles matafile\n") ;
  39.         exit(1) ;
  40.     }
  41. E 2
  42.     llinit() ;
  43.     /* load in the meta file */
  44.     readmeta(argv[1], inlist) ;
  45.  
  46. I 2
  47.     count = 0 ;
  48.     
  49. E 2
  50.     /* shuffle the files down */
  51.     for (i = 1; i <= inlist->count ; i ++)
  52.     {
  53.         /* get the ll entry we are dealing with */
  54.         llptr = llnofind(i, inlist) ;
  55. D 2
  56.         sprintf(fname, INSKELETON, i) ;
  57. E 2
  58. I 2
  59.         sprintf(fname, INSKELETON, count) ;
  60. E 2
  61.         if (strcmp(fname, llptr->datafile) == 0)
  62.         {
  63.             count ++ ;
  64.             continue ;
  65.         }
  66.         sprintf(tmp, "mv %s %s", llptr->datafile, fname) ;
  67.         system(tmp) ;
  68.         count ++ ;
  69.     }
  70.     /* free the linked list */
  71.     llfree(inlist) ;
  72.     /* note the meta file will be rebuilt anyway so ignore it */
  73.     printf("%d", count) ;
  74. }
  75.  
  76. E 1
  77.