home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC-Online 1998 February
/
PCOnline_02_1998.iso
/
filesbbs
/
dos
/
cutil100.exe
/
DOWNLOAD.MEX
next >
Wrap
Text File
|
1997-10-07
|
10KB
|
350 lines
/////////////////////////////////////////////////////////////////////////
//
// Originaly from StarDown V1.00 - (!)1996 Larry Monte\StarLab Systems Software
// CoolUtils V1.00 - (c)1996-97 Updated to look like RA by Neil Staib
//
// MEX: Copyright 1990, 1995 by Lanius Corporation. All rights reserved.
//
// DownLoad Command Replacement. Allows local users (sysops) to specify a
// path to extract tagged files to.
//
/////////////////////////////////////////////////////////////////////////
#include <prm.mh>
#include <max.mh>
// Comment the below if you have external protocols
#define protocol_opt
///////////////////////
// Language Definations
///////////////////////
#define notag "There are no currently tag files"
#define file "File:"
#define 1add "1 files added."
#define nosend "No files to send !"
#define taglist "Tagged file list (For Downloading):"
#define tfiles "files"
#define menu "(A)dd, (D)elete or (C)lear all entries (Enter to continue):"
#define delete "Delete:"
#define clear "Clear tag list (y/n)?"
#define yes "Yes"
#define no "No"
#define locald "Local download."
#define ldir "Directory to move files to:"
#define dprot "Default protocol:"
#define lmenu "(S)tart transfer, (L)ogoff after transfer, (N)ew protocol, (A)bort:"
#define protend "Protocol (Enter=quit):"
#define nosent "No Files Sent"
#define sent "File Sent"
#define sents "Files Sent"
/////////////////////
void main()
{
int: fnum, flags, pos, qsize, ok,new,done,prot, before, after;
long: fsize, txtime,tsize;
char: nonstop,inkey;
string: rootname, filescheck, added_filename, new_path, out_path,backslash,newdir;
string: delete_tag,ready_menu;
ok := 0;
new := 0;
prot := 0;
tsize :=0;
start:
qsize := (tag_queue_size());
if (qsize < 1 )
{
print(AVATAR_CLS);
print(COL_LRED, notag, ".\n");
print("\n");
print(COL_CYAN , file, " ");
input_str(added_filename, INPUT_WORD,0,14,"");
if (added_filename <> "")
{
input := "A;"+added_filename;
set_output(DISABLE_BOTH);
menu_cmd(512,"");
set_output(DISABLE_NONE);
print(COL_YELLOW, "\n", 1add);
new := 1;
}
if (tag_queue_size() < 1 )
{
print ("\n\n\n");
print (COL_YELLOW , nosend);
return;
}
}
else
{
// Show Tag Files
print(AVATAR_CLS);
print(COL_LRED, taglist, "\n");
print("\n");
reset_more(nonstop);
qsize := (tag_queue_size());
for (fnum := 0; fnum < qsize AND do_more(nonstop, COL_CYAN);
fnum := fnum + 1)
{
tag_get_name( fnum, flags, filescheck);
pos := strridx(filescheck, 0, '\\');
if (pos=0)
rootname := filescheck;
else
{
rootname := substr(filescheck, pos+1, strlen(filescheck)-pos+1);
fsize := (filesize(filescheck)/1000);
tsize := tsize + fsize;
print(COL_YELLOW, "(", fnum+1, ") ", COL_LMAGENTA, strpad(
rootname,13,' '), ' ', COL_LGREEN, ltostr(fsize), "k\n");
}
}
}
while (ok = 0)
{
if (prot = 1)
{
print(AVATAR_CLS, "\n\n");
goto newprot;
}
if (new = 1 )
{
print(AVATAR_CLS);
print(COL_LRED, taglist, "\n");
print("\n");
reset_more(nonstop);
qsize := (tag_queue_size());
for (fnum := 0; fnum < qsize AND do_more(nonstop, COL_CYAN);
fnum := fnum + 1)
{
tag_get_name( fnum, flags, filescheck);
pos := strridx(filescheck, 0, '\\');
if (pos=0)
rootname := filescheck;
else
{
rootname := substr(filescheck, pos+1, strlen(filescheck)-pos+1);
fsize := (filesize(filescheck)/1000);
tsize := tsize + fsize;
print(COL_YELLOW, "(", fnum+1, ") ", COL_LMAGENTA, strpad(
rootname,13,' '), ' ', COL_LGREEN, ltostr(fsize), "k\n");
}
}
new := 0;
}
print("\n");
qsize := (tag_queue_size());
print(COL_LCYAN ,qsize, " ", tfiles, " ", ltostr(tsize), "k \n");
print("\n");
print(COL_LCYAN, menu);
userenter:
inkey:=getch();
if (inkey = 'a' or inkey = 'A')
{
print("\n\n");
print(COL_CYAN , file, " ");
input_str(added_filename, INPUT_WORD,0,14,"");
if (added_filename <> "")
{
input := "A;"+added_filename;
set_output(DISABLE_BOTH);
menu_cmd(512,"");
set_output(DISABLE_NONE);
print(COL_YELLOW, "\n", 1add);
if (tag_queue_size() < 1 )
{
print ("\n\n\n");
print (COL_YELLOW, nosend);
ok := 1;
}
}
goto start;
}
if (inkey = 'd' or inkey = 'D')
{
print("\n\n");
print(COL_LRED, delete, " ");
input_str(delete_tag, INPUT_NLB_LINE,0,2,"");
if (delete_tag = "")
{
goto start;
}
else if (delete_tag <> "")
{
tag_dequeue_file((strtoi(delete_tag)-1));
goto start;
}
}
if (inkey = 'c' or inkey = 'C')
{
print("\n\n");
print(COL_LRED, clear, " ");
inkey:=getch();
if (inkey = 'y' or inkey = 'Y')
{
print(" ", yes, "\n");
input := "C;q;";
set_output(DISABLE_BOTH);
menu_cmd(512,"");
set_output(DISABLE_NONE);
goto start;
}
else if (inkey = 13 or inkey = 'n' or inkey = 'N')
{
print(" ", no);
goto start;
}
}
if (inkey = 13)
{
goto newprot;
}
goto userenter;
newprot:
before := (tag_queue_size());
if (tag_queue_size() > 0 and id.local = TRUE)
{
print("\n");
print(COL_WHITE, locald, "\n");
print("\n");
print(COL_LGREEN, ldir, " ");
input_str(new_path,INPUT_WORD,0,80,"");
if (new_path <> "" )
{
backslash := "\\";
newdir := new_path + backslash;
out_path := newdir;
qsize := (tag_queue_size());
for (fnum := 0; fnum < qsize; fnum := fnum +1)
{
tag_get_name( fnum, flags, filescheck);
pos := strridx(filescheck, 0, '\\');
if (pos=0)
rootname := filescheck;
else
rootname := substr(filescheck, pos+1,
strlen(filescheck)-pos+1);
filecopy(filescheck,out_path+rootname);
}
set_output(DISABLE_BOTH);
input := "C;|";
menu_cmd(512,"");
set_output(DISABLE_NONE);
ok := 1;
}
else
{
ok := 1;
}
}
else if (tag_queue_size() > 0 and id.local = FALSE)
{
print(COL_LGREEN, "\n", dprot, " ",protocol_num_to_name(usr.def_proto), "\n");
print(COL_LCYAN, lmenu, " ");
inkey:=getch();
if (inkey = 'l' or inkey = 'L')
{
input := "/g";
menu_cmd(505,"");
ok := 1;
}
if (inkey = 'a' or inkey = 'A')
{
ok := 1;
}
if (inkey = 13 or inkey = 's' or inkey = 'S')
{
input := "|";
menu_cmd(505,"");
ok := 1;
}
if (inkey = 'n' or inkey = 'N')
{
#ifdef protocol_opt
{
display_file(prm_string(PRM_PROTOCOLS),nonstop);
print(protend, " ");
do
{
inkey:=getch();
if (inkey = 'z' or inkey = 'y' or inkey = 'g' or inkey = 'x' or inkey = '1' or inkey = 's' or inkey=13 or inkey = 'Z' or inkey = 'Y' or inkey = 'G' or inkey = 'X' or inkey = 'S')
{
done:=TRUE;
if (inkey='z' or inkey = 'Z' )
usr.def_proto:= PROTOCOL_ZMODEM ;
else if (inkey='y' or inkey ='Y')
usr.def_proto:= PROTOCOL_YMODEM ;
else if (inkey='g' or inkey = 'G')
usr.def_proto:= PROTOCOL_YMODEMG ;
else if (inkey='x' or inkey = 'X')
usr.def_proto:= PROTOCOL_XMODEM ;
else if (inkey='1')
usr.def_proto:= PROTOCOL_XMODEM1K ;
else if (inkey='s' or inkey = 'S')
usr.def_proto:= PROTOCOL_SEALINK ;
}
else
{
done:=FALSE;
}
}
while (done = FALSE);
prot:=1;
}
#else
{
print(AVATAR_CLS, "\n");
print(protocol_num_to_name(usr.def_proto), '\n');
menu_cmd(618, "");
}
#endif
}
}
}
after := (tag_queue_size());
if ((before - after) = 0)
{
print(COL_LRED, "\n" , nosent);
}
if ((before - after) = 1)
{
print(COL_LRED, "\n", (before - after), " ", sent,"\n");
}
if ((before - after) > 1)
{
print(COL_LRED, "\n", (before - after), " ", sents, "\n");
}
sleep(2);
}