home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / WWIVMODS / MODSUNKN.ZIP / RENXFER.MOD < prev    next >
Text File  |  1992-01-29  |  2KB  |  75 lines

  1. Modification to //REN in the Xfer section.
  2. Well, I got sick of the BBS only allowing me to change one filename or
  3. description on the //REN xfer command.  So, below is my version which will
  4. loop through all files if a pattern is given to the "File to rename:" 
  5. prompt.
  6. Just take the code below and replace the entire subroutine in XFER.C
  7.  
  8.         The Black Dragon.
  9.         Black Dragon Enterprises.
  10. */
  11.  
  12. void rename_file()
  13. {
  14.   char s[81],s0[81],s1[81],s2[81];
  15.   int count,i;
  16.   uploadsrec u;
  17.  
  18.   nl();
  19.   nl();
  20.   prt(2,"File to rename: ");
  21.   input(s,12);
  22.   if (!s[0])
  23.     return;
  24.   if (strchr(s,'.')==NULL)
  25.     strcat(s,".*");
  26.   align(s);
  27.   dliscan();
  28.   nl();
  29.   count=0;
  30.   i=recno(s);
  31.   while ((i>0) && !hangup) {
  32.     SETREC(i);
  33.     read(dlf,(void *)&u,sizeof(uploadsrec));
  34.     printfileinfo(&u);
  35.     nl();
  36.     prt(2,"New filename? ");
  37.     input(s0,12);
  38.     if (s0[0]) {
  39.       align(s0);
  40.       if (strcmp(s0,"        .   ")) {
  41.         strcpy(s1,directories[udir[curdir].subnum].path);
  42.         strcpy(s2,s1);
  43.         strcat(s1,s0);
  44.         if (exist(s1))
  45.           pl("Filename already in use; not changed.");
  46.         else {
  47.           strcat(s2,u.filename);
  48.           rename(s2,s1);
  49.           if (exist(s1))
  50.             strcpy(u.filename,s0);
  51.           else
  52.             pl("Bad filename.");
  53.         }
  54.       }
  55.     }
  56.     nl();
  57.     pl("New description:");
  58.     prt(2,": ");
  59.     inputl(s0,58);
  60.     if (s0[0]) {
  61.       strcpy(u.description,s0);
  62.     }
  63.     SETREC(i);
  64.     write(dlf,(void *)&u,sizeof(uploadsrec));
  65.     i=nrecno(s,i);
  66.     count++;
  67.   }
  68.   if (count) {
  69.     sprintf(s,"%d file(s) found",count);
  70.     pl(s);
  71.     }
  72.   else
  73.     pl("No files found.");
  74.   closedl();
  75. }