home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / UTIL / WWIVE / MYWIVE.ZIP / DUPFILE.MOD < prev    next >
Text File  |  1992-12-01  |  3KB  |  112 lines

  1. : Mod to search for duplicate files in ALL directories.....
  2. Name: White Rabbit #102 @8410
  3. Origin: [The Bounty @ 804-780-9622]
  4. Region: [ Virginia ]
  5. Date: Fri Apr 14 14:02:34 1989
  6.  
  7. A lot of people have been asking for this mod to be done, and it finally is!
  8. This will scan ALL directories for a filename match on the filename entered
  9. to be uploaded.  You will find the code section in XFER.C (where else) and
  10. all you need to do is replace the first section of the original code with
  11. the section shown below.  Some portions of the original can be used as is,
  12. but I found it a lot easier to just replace the original with the modified
  13. using a block read.  One thing it does require now, that was not in the
  14. original code is that the filename must be at least 4 chars long.  No more
  15. 'A', 'B', etc. files from the Commodore systems.  The extension DOES count
  16. in the length requirement, though, making it possible to have a filename of
  17. 'A.C64' and the like.
  18.  
  19. Hope you enjoy it.  I know I have!!
  20.  
  21.                                              White Rabbit
  22.                                              (aka Steve Johns)
  23.  
  24. void upload(int dn)
  25. {
  26.   directoryrec d;
  27.   uploadsrec u,u1;
  28.   int ocd,i,i1,i2,ok,xfer,f;
  29.   char s[81],s1[81],s2[81];
  30.   long l;
  31.   double ti;
  32.  
  33.   helpl=17;
  34.   dliscan1(dn);
  35.   d=directories[dn];
  36.   if (numf>=d.maxfiles) {
  37.     nl();
  38.     nl();
  39.     pl("This directory is currently full.");
  40.     nl();
  41.     closedl();
  42.     return;
  43.   }
  44.   nl();
  45.   ti=freek1((d.path));
  46.   ltoa((long) (ti),s1,10);
  47.   strcpy(s,"Upload - ");
  48.   strcat(s,s1);
  49.   strcat(s,"k free.");
  50.   pl(s);
  51.   nl();
  52.   if (ti<100.0) {
  53.     pl("Not enough disk space to upload here.");
  54.     nl();
  55.     closedl();
  56.     return;
  57.   }
  58.   prt(5,"Enter Name of File (4 chars min.)");
  59.   prt(2,"Filename: ");
  60.   input(s,12);
  61.   if (!okfn(s))
  62.     s[0]=0;
  63.   ok=0;
  64.   xfer=1;
  65.   if (strlen(s)>4) {
  66.     align(s);
  67.     ocd=curdir;
  68.     ok=1;
  69.     nl();
  70.     pl("Standby....Checking for duplicate files....");
  71.     nl();
  72.     for (i=0; (i<64) && (!hangup) && (udir[i].subnum!=-1); i++) {
  73.       i1=udir[i].subnum;
  74.       curdir=i;
  75.       dliscan();
  76.       for (i1=1; (i1<=numf) && (!hangup); i1++) {
  77.         SETREC(i1);
  78.         read(dlf,(void *)&u,sizeof(uploadsrec));
  79.         if (compare(s,u.filename)) {
  80.           prt(2,"That file already exists on this system.");
  81.           nl();
  82.           ok=0;
  83.           }
  84.         }
  85.         closedl();
  86.       }
  87.     curdir=ocd;
  88.     dliscan1(dn);
  89.     d=directories[dn];
  90.     strcpy(u.filename,s);
  91.     u.ownerusr=usernum;
  92.     u.ownersys=0;
  93.     u.numdloads=0;
  94.     u.filetype=0;
  95.     u.mask=0;
  96.     strcpy(u.upby,nam1(&thisuser,usernum,syscfg.systemnumber));
  97.     strcpy(u.date,date());
  98.     }
  99.   if (ok) {                    /* from here on can remain intact */
  100.     strcpy(s1,"Upload '");
  101.     strcat(s1,s);
  102.     strcat(s1,"' ? ");
  103.     if (strcmp(s,"        .   "))
  104.       prt(5,s1);
  105.     else
  106.       ok=0;}
  107.  
  108.  
  109. ....and that does it. Told ya it was pretty simple.  Anyway, I hope this
  110. some of you who have had this problem develop on your systems with the
  111. duplicate uploads.
  112.