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

  1. // Hurl.mex
  2. //
  3. // Written by Craig Allsop
  4. // White Lightning @ 3:640/225
  5. // Created: 2-1-96
  6. //
  7. // Extended hurl command, will hurl all tagged files into another area.
  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.  ");
  24.  
  25.   if (qsize and strlen(input)=0)
  26.   {
  27.     int: len;
  28.     string: entry;
  29.  
  30.     len:=input_str( entry, INPUT_WORD|INPUT_NOLF, 0, 12, "Hurl to? " );
  31.  
  32.     if (len)
  33.     {
  34.     print('\n');
  35.  
  36.     nonstop := False;
  37.  
  38.     for ( fnum := 0; fnum < qsize AND do_more(nonstop, COL_CYAN); fnum := fnum + 1 )
  39.     {
  40.       tag_get_name( fnum, flags, filename );
  41.  
  42.       // We need to strip off the path name for display
  43.  
  44.       pos := strridx(filename, 0, '\\');
  45.       if (pos=0)
  46.       rootname := filename;
  47.       else rootname := substr(filename, pos+1, strlen(filename)-pos+1);
  48.  
  49.       print(COL_YELLOW, strpad(rootname,13,' '), ' ');
  50.  
  51.       fsize := filesize(filename);
  52.  
  53.       // Now display the file details
  54.  
  55.       if (fsize=-1)
  56.       {
  57.  
  58.         // Dequeue it if it isn't there...
  59.  
  60.         print(COL_WHITE, "** file no longer exists and has been dequeued **\n");
  61.         tag_dequeue_file(fnum);
  62.         fnum := fnum - 1;
  63.         qsize := tag_queue_size();
  64.       }
  65.       else
  66.       {
  67.  
  68.       // Otherwise, tell the user the size & date
  69.  
  70.     print(COL_MAGENTA, strpadleft(ltostr(fsize shr 10),5,' '), "k  ", COL_CYAN);
  71.     input:=input+rootname+";"+entry+";";
  72.     menu_cmd(MNU_FILE_HURL,"");
  73.     tag_dequeue_file(fnum);
  74.         fnum := fnum - 1;
  75.         qsize := tag_queue_size();
  76.       }
  77.     }
  78.     print('\n');
  79.   }
  80.   }
  81.   else
  82.       {
  83.       print('\n');
  84.       menu_cmd(MNU_FILE_HURL,"");
  85.       }
  86.   return 0;
  87. }
  88.  
  89.