home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / ctf112.zip / KILL.MEX < prev    next >
Text File  |  1996-01-02  |  2KB  |  76 lines

  1. // Kill.mex
  2. //
  3. // Written by Craig Allsop
  4. // White Lightning @ 3:640/225
  5. // Created: 2-1-96
  6. //
  7. // Extended kill command, will kill all tagged files.
  8. //
  9.  
  10. #include <max.mh>
  11. #include <max_menu.mh>
  12.  
  13. int main()
  14. {
  15.   int: qsize, fnum, flags, pos;
  16.   long: fsize;
  17.   struct _stamp: fdate;
  18.   string: filename, rootname;
  19.   char: nonstop;
  20.  
  21.   qsize := tag_queue_size();
  22.  
  23.   print(COL_WHITE "\nYou have ", qsize, " files tagged.\n");
  24.  
  25.   if (qsize and strlen(input)=0)
  26.   {
  27.     nonstop := False;
  28.  
  29.     print('\n');
  30.     for ( fnum := 0; fnum < qsize AND do_more(nonstop, COL_CYAN); fnum := fnum + 1 )
  31.     {
  32.       tag_get_name( fnum, flags, filename );
  33.  
  34.       // We need to strip off the path name for display
  35.  
  36.       pos := strridx(filename, 0, '\\');
  37.       if (pos=0)
  38.       rootname := filename;
  39.       else rootname := substr(filename, pos+1, strlen(filename)-pos+1);
  40.  
  41.       print(COL_YELLOW, strpad(rootname,13,' '), ' ');
  42.  
  43.       fsize := filesize(filename);
  44.  
  45.       // Now display the file details
  46.  
  47.       if (fsize=-1)
  48.       {
  49.  
  50.         // Dequeue it if it isn't there...
  51.  
  52.         print(COL_WHITE, "** file no longer exists and has been dequeued **\n");
  53.         tag_dequeue_file(fnum);
  54.         fnum := fnum - 1;
  55.         qsize := tag_queue_size();
  56.       }
  57.       else
  58.       {
  59.  
  60.       // Otherwise, tell the user the size & date
  61.  
  62.     print(COL_MAGENTA, strpadleft(ltostr(fsize shr 10),5,' '), "k  ", COL_CYAN);
  63.     input:=input+rootname+";";
  64.     menu_cmd(MNU_FILE_KILL,"");
  65.     tag_dequeue_file(fnum);
  66.         fnum := fnum - 1;
  67.         qsize := tag_queue_size();
  68.       }
  69.     }
  70.   }
  71.   else
  72.       menu_cmd(MNU_FILE_KILL,"");
  73.   return 0;
  74. }
  75.  
  76.