home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
telix
/
tlxpcp15.arc
/
OPTIONS.SLT
< prev
next >
Wrap
Text File
|
1989-01-06
|
8KB
|
319 lines
//This area is for the user configurable variables of this script
str message_tone[]="y";
str maintain_log[]="y";
///////////////////////////////////////////////////////////////////////////////
// //
// options v1.5 Copyright (c) by Charles Lee //
// January 1989 //
// //
///////////////////////////////////////////////////////////////////////////////
beep(int freq)
{
if((message_tone=="y")|(message_tone=="Y"))
{
tone(freq,20);
}
}
disp_monthly()
{
int fp,
t,
t1;
str monthly_time_file[76],
elapse_time[12];
monthly_time_file=_script_dir;
strcat(monthly_time_file,"mtelapse.pcp");
fp=fopen(monthly_time_file,"r");
fgets(elapse_time,12,fp);
fclose(fp);
pstraxy("Total Monthly Elapsed Time is: ",27,19,10);
t=stoi(elapse_time);
t1=t/3600;
gotoxy(33,20);
printn(t1);
pstraxy(" hr(s) ",getx(),gety(),10);
t1=(t-t1*3600)/60;
printn(t1);
pstraxy(" mins.",getx(),gety(),10);
return;
}
main()
{
int menu_bar_pos,
key,
screen_handle,
fp,
fp1,
connect_time,
t,
maintain_log_flag=0;
str usage_log_path[76],
file_path[76],
monthly_time_file[76],
start_time[12],
elapse_time[12],
buffer[12];
monthly_time_file=_script_dir;
strcat(monthly_time_file,"mtelapse.pcp");
if((maintain_log=="Y")|(maintain_log=="y"))
{
usage_log_path=_script_dir;
strcat(usage_log_path,"usage.pcp");
fp=fopen(usage_log_path,"a+");
fseek(fp,-3,2);
if(fgetc(fp)=='P')
{
fseek(fp,-3,2);
fputc(0x20,fp);
status_wind("Updating usage log!",30);
t=curtime();
fseek(fp,0,2);
fputs(" disconnected at ",fp);
time(t,buffer);
fputs(buffer,fp);
fputs(".",fp);
fputc(0x0d,fp);
fputc(0x0a,fp);
}
fseek(fp,0,2);
maintain_log_flag=1;
}
//Save the screen
screen_handle=vsavearea(0,0,79,24);
clear_scr();
box(30,5,51,15,4,0,11);
box(33,6,48,8,4,0,11);
pstraxy("Options Menu",35,7,15);
pstraxy(" moves menu bar",32,16,12);
pstraxy(" ┘ selects ",32,17,12);
disp_monthly();
cursor_onoff(0);
menu_bar_pos=0;
while(1)
{
if(menu_bar_pos==0)
{
pstraxy("Goto BBS dialer ",32,10,0x4f);
}
else
{
pstraxy("Goto BBS dialer ",32,10,14);
}
if(menu_bar_pos==1)
{
pstraxy("Goto CITY dialer ",32,11,0x4f);
}
else
{
pstraxy("Goto CITY dialer ",32,11,14);
}
if(menu_bar_pos==2)
{
pstraxy("Disconnect City ",32,12,0x4f);
}
else
{
pstraxy("Disconnect City ",32,12,14);
}
if(menu_bar_pos==3)
{
pstraxy("Log off PC Pursuit",32,13,0x4f);
}
else
{
pstraxy("Log off PC Pursuit",32,13,14);
}
if(menu_bar_pos==4)
{
pstraxy("Quit to PCP prompt",32,14,0x4f);
}
else
{
pstraxy("Quit to PCP prompt",32,14,14);
}
_scr_chk_key=0;
key=inkeyw();
if(key==0x4800)
{
if(menu_bar_pos)
{
menu_bar_pos=menu_bar_pos-1;
}
else
{
beep(500);
}
}
if(key==0x5000)
{
if(menu_bar_pos<4)
{
menu_bar_pos=menu_bar_pos+1;
}
else
{
beep(500);
}
}
if(key==0x0d)
{
break;
}
if(!((key==0x4800)|(key==0x5000)|(key==0x0d)))
{
beep(500);
status_wind("Unknown command!",10);
cursor_onoff(0);
}
}
vrstrarea(screen_handle);
if(menu_bar_pos==0)
{
ustamp("*** BBS dialer invoked.",1,1);
if(maintain_log_flag)fclose(fp);
call("dialbbs.slc");
return;
}
if(menu_bar_pos==1)
{
if(maintain_log_flag)fclose(fp);
call("citydial.slc");
return;
}
if(menu_bar_pos==2)
{
status_wind("Attempting to disconnect city!",10);
cputs_tr("^M~@~^M~D~^M");
key=waitfor("DISCONNECTED",5);
if(key)
{
beep(3000);
status_wind("Success!",10);
ustamp("*** City disconnected.",1,1);
if(maintain_log_flag)
{
status_wind("Updating usage log!",30);
t=curtime();
fputs(" disconnected at ",fp);
time(t,buffer);
fputs(buffer,fp);
fputs(".",fp);
fputc(0x0d,fp);
fputc(0x0a,fp);
fclose(fp);
}
file_path=_script_dir;
strcat(file_path,"temptime.pcp");
fp1=fopen(file_path,"r");
fgets(start_time,12,fp1);
fclose(fp1);
fp1=fopen(monthly_time_file,"r");
fgets(elapse_time,12,fp1);
fclose(fp1);
connect_time=curtime()-stoi(start_time);
//Round the elapsed time up to the nearest minute
t=connect_time/60;
if((t*60)!=(connect_time))
{
t=t+1;
}
connect_time=t*60;
if(maintain_log_flag)
{
file_path=_script_dir;
strcat(file_path,"usage.pcp");
fp1=fopen(file_path,"a+");
fputs(" elapsed time: ",fp1);
t=connect_time/3600;
itos(t,buffer);
fputs(buffer,fp1);
fputs(" hr(s) ",fp1);
t=(connect_time-(t*3600))/60;
itos(t,buffer);
fputs(buffer,fp1);
fputs(" mins.",fp1);
fputc(0x0d,fp1);
fputc(0x0a,fp1);
fclose(fp1);
}
t=connect_time+stoi(elapse_time);
itos(t,buffer);
fp1=fopen(monthly_time_file,"w");
fputs(buffer,fp1);
fputc(0x0d,fp1);
fputc(0x0a,fp1);
fclose(fp1);
return;
}
else
{
beep(500);
status_wind("Unsuccessful Attempt!",10);
if(maintain_log_flag)fclose(fp);
return;
}
}
if(menu_bar_pos==3)
{
status_wind("Attempting to log off!",10);
cputs_tr("^M~@^M~hangup~^M");
loadfon("telix.fon");
_dial_time=30;
ustamp("*** PC Pursuit disconnected.",1,1);
if(maintain_log_flag)
{
beep(3000);
status_wind("Updating usage log!",30);
t=curtime();
fputc(0x0d,fp);
fputc(0x0a,fp);
fputs("Logged off PC Pursuit on ",fp);
date(t,buffer);
fputs(buffer,fp);
fputs(" at ",fp);
time(t,buffer);
fputs(buffer,fp);
fputs(".",fp);
fputc(0x0d,fp);
fputc(0x0a,fp);
fclose(fp);
}
return;
}
if(menu_bar_pos==4)
{
status_wind("Returning to PCP Prompt!",10);
cputs_tr("^M~@~^M");
if(maintain_log_flag)fclose(fp);
return;
}
}