home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
UTIL
/
WWIVE
/
MYWIVE.ZIP
/
BBS.C
< prev
next >
Wrap
Text File
|
1993-05-05
|
34KB
|
1,542 lines
#pragma hdrstop
#define _DEFINE_GLOBALS_
#include "vars.h"
#include <math.h>
unsigned _stklen=15360;
#define modem_time 3.5
int goldflag;
int checkpw()
{
char s[81];
nl();
outstr("1SY 7> f");
echo=0;
input(s,20);
echo=1;
if (strcmp(s,(syscfg.systempw))==0)
return(1);
else
return(0);
}
void end_bbs(int lev)
{
sl1(1,"");
if (ok_modem_stuff)
closeport();
dtr(0);
outs(VERSION_NUMBER);
outs(" run complete.\r\n\r\n");
exit(lev);
}
void sublist()
{
int i,abort;
char s[80];
abort=0;
nl();
pla("1-=*Message Subs Available*=-",&abort);
nl();
i=0;
while ((i<MAX_SUBS) && (usub[i].subnum!=-1)) {
npr("7[1%2s7] 1%-34s",usub[i].keys,subboards[usub[i].subnum].name);
i=i+1;
if ((i<MAX_SUBS) && (usub[i].subnum!=-1))
npr("7[1%2s7] 1%-34s\r\n",usub[i].keys,subboards[usub[i].subnum].name);
i++;
}
nl();
if (i==0)
pla("6None.",&abort);
nl();
}
void dirlist()
{
int i,abort;
char s[80];
abort=0;
nl();
pla(" 1Directories availablee: ",&abort);
nl();
i=0;
while ((i<MAX_DIRS) && (udir[i].subnum!=-1)) {
npr(" 7[1%2s7] e- 1%-25s",udir[i].keys, directories[udir[i].subnum].name);
i=i+1;
if ((i<MAX_DIRS) && (udir[i].subnum!=-1))
npr("7[1%2s7] e- 1%-27s\r\n",udir[i].keys, directories[udir[i].subnum].name);
i++;
}
nl();
if (i==0)
pla("6None.",&abort);
nl();
}
void text_edit()
{
char s[81],s1[81];
nl();
prt(3,"1What is the filename? ");
mpl(12);
input(s,12);
if (strstr(s,".LOG")!=NULL)
s[0]=0;
if (s[0]) {
sprintf(s1,"@ Edited: %s",s);
sysoplog(s1);
if (okfsed())
external_edit(s,syscfg.gfilesdir,thisuser.defed-1,500);
else
tedit(s);
}
}
void send_email()
{
char s1[81],*ss;
int i,sy,un;
nl();
nl();
pl("1Who do you want to E-mail? ");
helpl=14;
outstr("7> ");
mpl(40);
input(s1,40);
helpl=0;
irt[0]=0;
irt_name[0]=0;
un=0;
sy=0;
ss=strchr(s1,'@');
if (ss==NULL) {
un=finduser1(s1);
if (un>0)
email(un,sy,0,0);
else
pl("1Sorry, there is nobody here by that name!");
} else {
ss[0]=0;
ss=&(ss[1]);
i=strlen(s1);
while ((i>0) && (s1[i-1]==' '))
--i;
s1[i]=0;
un=atoi(s1);
sy=atoi(ss);
if ((un<0) || (sy<=0) || (sy==syscfg.systemnumber)) {
un=finduser1(s1);
if (un>0)
email(un,0,0,0);
else
pl("1Sorry there is nobody here by that name!");
} else {
if (un==0) {
strcpy(net_email_name,s1);
i=strlen(net_email_name);
while ((i>0) && (net_email_name[i-1]==' '))
--i;
net_email_name[i]=0;
if (net_email_name[0])
email(un,sy,0,0);
} else
email(un,sy,0,0);
}
}
}
void logoff1()
{
char ch;
helpl=12;
nl();
nl();
npr("eGoodbye\r\n");
nl();
pl("7[117] 1Oops7, 1Quit back to board");
pl("7[127] 1Fast Logoff");
pl("7[137] 1Logoff with ansi");
pl("7[147] 1Leave a note to the Sysop before leaving");
if (usernum==133)
pl("7[157] 1Apply For Access To System");
nl();
outstr("7() 1Command 7(> f");
ch=onek("12345");
switch(ch) {
case '1':
break;
case '2':
hangup=1;
break;
case '3':
outchr(12);
npr("Time on = %s\r\n",ctim(timer()-timeon));
printfile("LOGOFF");
hangup=1;
break;
case '4':
strcpy(irt,"Log Off Feedback");
email(1,0,0,0);
hangup=1;
break;
case '5':
newuser();
break;
}
}
void sysopmenu()
{
int done,i;
char ch,*s, s1[81],s2[81];
done=0;
printmenu(5);
do {
tleft(1);
npr("7[1Time left7] - 1%s\r\n",ctim(nsl()));
npr("1The Devil's Doorknob Sysop Menu\r\n");
outstr("7() 1Command 7(> f");
ch=onek("ABCDEFGHIJKLMNOPQRSTUVWXYZ?");
switch(ch) {
case 'A':
sysoplog("@ Ran Boardedit");
boardedit();
break;
case 'B':
sysoplog("@ Ran Diredit");
dlboardedit();
break;
case 'C':
sysoplog("@ Ran Chainedit");
chainedit();
break;
case 'D':
sysoplog("@ Ran Gfileedit");
gfileedit();
break;
case 'E':
nl();
outstr("1PW 7> f");
echo=0;
input(s,20);
echo=1;
if (strcmp(s,("REGARD"))==0) {
sysoplog("@ Molested DOS");
shrink_out(getenv("COMSPEC"),1,1,1,0);
topscreen();
}
break;
case 'F':
reset_files();
break;
case 'G':
dtr(0);
sysoplog("@ Reset the computer");
logoff();
sl1(1,"");
if (ok_modem_stuff)
closeport();
setvect(INT_SAVE_21,(void interrupt (*) ()) MK_FP(0xffff,0x0000));
geninterrupt(INT_SAVE_21);
break;
case 'H':
read_new_stuff();
break;
case 'I':
nl();
prt(1,"What is the filename? ");
mpl(50);
input(s1,50);
if (s1[0]) {
if ((okansi()) && (thisuser.defed))
external_edit(s1,"",thisuser.defed-1,500);
else
tedit(s1);
}
break;
case 'J':
nl();
prt(1,"What is the filename? ");
mpl(50);
input(s1,50);
if (s1[0]) {
nl();
prt(5,"eAllow editing? ");
if (yn()) {
nl();
load_workspace(s1,0);
} else {
nl();
load_workspace(s1,1);
}
}
break;
case 'K':
chuser();
break;
case 'L':
nl();
npr("1Stack size7: 1%d\r\n",_stklen);
npr("1Heap free 7: 1%dk\r\n", (int) (farcoreleft()/1024));
nl();
break;
case 'M':
sysoplog("@ Read all mail");
mailr();
break;
case 'N':
nl();
pl(((*(char far *)0x00000417L ^= 0x10) & 0x10) ?
"fGilgamesh is now available" :
"fGilgamesh is now unavailable");
sysoplog("@ Changed sysop avail status");
topscreen();
break;
case 'O':
prstatus();
break;
case 'P':
sysoplog("@ Ran Ivotes");
ivotes();
break;
case 'Q':
done=1;
break;
case 'R':
sl1(3,s1);
printfile(s1);
break;
case 'S':
sysoplog("@ Ran Tedit");
text_edit();
break;
case 'T':
printfile(status.log1);
break;
case 'U':
sysoplog("@ Ran Uedit");
uedit(usernum,0);
break;
case 'V':
zlog();
break;
case 'W':
voteprint();
break;
case 'Z':
helpl=14;
if (!cs())
return;
nl();
nl();
pl("1Which user?");
outstr("7>");
mpl(30);
input(s1,30);
i=finduser1(s1);
if (i>0) {
sysoplog("@ Validated user");
valuser(i);
} else
pl("1Sorry there is nobody here by that name!");
break;
case '?':
printmenu(5);
break;
}
} while ((!done) && (!hangup));
}
void msgmenu()
{
char *s, s1[81],s2[81],s3[81];
int msgloads,i;
long l;
subboardrec r; /* Added */
msgloads=0;
do{
if ((sysstatus_expert & thisuser.sysstatus)==0)
printmenu(17);
nl();
nl();
npr("1Post7/1Call Ratio 1%-5.3f\r\n",post_ratio(),syscfg.post_call_ratio);
tleft(1);
npr("7[1Time left7] - 1%s\r\n",ctim(nsl()));
s1[0]=0;
if (usub[cursub].subnum==-1) {
cursub=0;
if (usub[cursub].subnum==-1) {
strcpy(s1,"[] No Subs Available :");
}
}
if (s1[0]==0)
npr("1Sub 7(> [1%s7] [1%s7]\r\n",usub[cursub].keys,subboards[usub[cursub].subnum].name);
outstr("1Command 7(> f");
helpl=29;
s=mmkey(0);
helpl=0;
if (s[0])
for (i=0; i<MAX_SUBS; i++)
if (strcmp(usub[i].keys,s)==0)
cursub=i;
sysopchar(s);
/****************************************/
if ((strcmp(s,"UPLOAD")==0) && (actsl>1))
upload_post();
if (strcmp(s,"QSCAN")==0) {
nl();
prt(5,"eDo you really want to clear your Q-Scan pointers? ");
if (yn()) {
for (i=0; i<33; i++)
thisuser.qscnptr[i]=status.qscanptr-1L;
#if MAX_SUBS>32
for (i=0; i<MAX_SUBS-32; i++)
thisuser.qscnptr2[i]=status.qscanptr-1L;
#endif
nl();
pl("fOk the Q-Scan are pointers cleared.");
nl();
}
}
if (strcmp(s,"/N")==0)
nscan(cursub);
if (strcmp(s,"RSET")==0) {
for (i=0; i<MAX_SUBS; i++)
sub_dates[i]=0L;
}
if ((s[1]==0) && (s[0]!=0)) {
switch(s[0]) {
case ']':
if ((cursub<MAX_SUBS-2) && (usub[cursub+1].subnum>=0))
++cursub;
else
cursub=0;
break;
case '[':
if (cursub>0)
--cursub;
else {
while ((usub[cursub+1].subnum>=0) && (cursub<MAX_SUBS-1))
++cursub;
}
break;
case 'Q':
msgloads=1;
break;
case 'A':
r=subboards[cursub];
sprintf(s3,"%s.INT", r.filename);
printfile(s3);
break;
case 'C':
reqchat();
break;
case 'E':
feedback();
break;
case 'H':
if ((actsl==255) && (checkpw())) {
nl();
outstr("1PW 7> f");
echo=0;
input(s,20);
echo=1;
if (strcmp(s,("STEEPLE"))==0)
sysopmenu();
} else
pl("1You do not have access to that command");
break;
case 'N':
express=0;
expressabort=0;
nscan(0);
break;
case 'G':
logoff1();
break;
case 'P':
irt[0]=0;
irt_name[0]=0;
if (usub[0].subnum!=-1)
post();
break;
case 'S':
i=0;
express=0;
expressabort=0;
qscan(cursub,&i);
break;
case 'D':
helpl=15;
remove_post();
break;
case 'R':
express=0;
expressabort=0;
scan2();
break;
case 'U':
list_users();
break;
case 'X':
thisuser.sysstatus ^= sysstatus_expert;
break;
case 'Z':
express=1;
expressabort=0;
l=thisuser.sysstatus;
if (l & sysstatus_pause_on_page)
thisuser.sysstatus ^= sysstatus_pause_on_page;
nscan(0);
express=0;
expressabort=0;
thisuser.sysstatus=l;
break;
case '?':
if ((sysstatus_expert & thisuser.sysstatus))
printmenu(17);
break;
case '*':
sublist();
break;
}
}
helpl=0;
} while ((!msgloads) && (!hangup));
}
void mainmenu()
{
FILE *fp;
char *s, s1[81],s2[81],ch;
int golds,golda,goldb,i;
long l;
if ((sysstatus_expert & thisuser.sysstatus)==0)
printmenu(0);
nl();
nl();
if (sysop2())
npr("1Gilgamesh is7: 1Watching your every move!\r\n");
else
npr("1Gilgamesh is7: 1Out Llama tipping!\r\n");
tleft(1);
npr("7[1Time left7] - 1%s\r\n",ctim(nsl()));
s1[0]=0;
if (usub[cursub].subnum==-1) {
cursub=0;
if (usub[cursub].subnum==-1) {
strcpy(s1,"[] No Subs Available :");
}
}
if (s1[0]==0)
outstr("1Main Menu Command 7(> f");
/*prt(2,s1);*/
helpl=1;
s=mmkey(0);
helpl=0;
/* if (s[0])
for (i=0; i<MAX_SUBS; i++)
if (strcmp(usub[i].keys,s)==0)
cursub=i;*/
sysopchar(s);
/****************************************/
if (cs()) {
if (strcmp(s,"PENDING")==0) {
print_pending_list();
}
if (strcmp(s,"NLOG")==0) {
printfile("NET.LOG");
}
}
/*************************************************/
if (strcmp(s,"CLS")==0)
outstr("\x0c");
if (strcmp(s,"NET")==0)
print_net_listing(0);
if (strncmp(s,"NET=",4)==0) {
print_net_listing(atoi(s+4));
}
if (strcmp(s,"RSET")==0) {
for (i=0; i<MAX_SUBS; i++)
sub_dates[i]=0L;
}
if (strcmp(s,"BBSADD")==0)
write_bbsadd();
if (strcmp(s,"VER")==0) {
nl();
pl(VERSION_NUMBER);
nl();
pl("1The author may be contacted ate:");
nl();
pl(" 1Wayne Bell");
pl(" 1904 Silver Spur Road #636");
pl(" 1Rolling Hills Estates, CA 90274");
nl();
}
if ((s[1]==0) && (s[0]!=0)) {
switch(s[0]) {
case 'O':
if (thisuser.ass_pts>=10) {
npr("1You have too many 6ass 1points to play games");
break; }
helpl=26;
game_ratio();
break;
case 'A':
helpl=19;
write_automessage();
break;
case 'B':
helpl=25;
bbslist();
break;
case 'C':
reqchat();
break;
case 'D':
helpl=4;
defaults();
break;
case '$':
donate();
break;
case 'F':
if (goldflag==1) {
pl("1I am sorry you can only buy time once per call");
} else {
if (thisuser.gold<=0) {
pl("1I am sorry you do not have any gold to buy time with");
} else {
npr("1You have 7%d 1gold\r\n",(int) thisuser.gold);
pl("1Any time you buy is good only for this call");
pl("1One gold piece is worth two minutes");
pl("1How much gold would you like to spend?");
pl("1`Enter' for none");
outstr(": ");
mpl(2);
input(s,2);
i=atoi(s);
if (s[0]==0)
golds=0;
else {
if (s[0])
golds=i;
if (golds>thisuser.gold) {
pl("You do not have that much gold!");
golds=0;
} else {
thisuser.gold=thisuser.gold-golds;
golda=(golds*2.0)*60.0;
/*goldb=golda*60.0;*/
thisuser.extratime=golda;
goldflag=1; }}
if (golds==0)
goldflag=0;
}
}
break;
case 'E':
feedback();
break;
case '.':
helpl=28;
gfiles();
break;
case 'H':
if ((actsl==255) && (checkpw())) {
nl();
outstr("1PW 7> f");
echo=0;
input(s,20);
echo=1;
if (strcmp(s,("STEEPLE"))==0)
sysopmenu();
} else
pl("1You do not have access to that command");
break;
case 'I':
nl();
pl(VERSION_NUMBER);
nl();
printfile("LOGON");
printfile("SYSTEM");
break;
case 'L':
printfile("USER.LOG");
break;
case 'G':
logoff1();
break;
case 'M':
msgmenu();
break;
case 'T':
if (thisuser.ass_pts>=10) {
npr("1You have too many 6ass 1points to transfer");
break; }
if (syscfg.sysconfig & sysconfig_no_xfer) {
nl();
pl("Sorry, the transfer section has been closed by the sysop.");
nl();
break;
}
if (udir[0].subnum!=-1) {
curdloads=1;
printmenu(16);
} else {
nl();
pl("1You cannot currently access the file section.");
nl();
}
break;
case 'V':
helpl=18;
vote();
break;
case 'X':
thisuser.sysstatus ^= sysstatus_expert;
break;
case '?':
if ((sysstatus_expert & thisuser.sysstatus))
printmenu(0);
break;
}
}
helpl=0;
}
void dlmainmenu()
{
char *s, s1[81],s2[81],ch;
int i,i1,i2,abort,next;
messagerec m;
if ((sysstatus_expert & thisuser.sysstatus)==0)
printmenu(3);
nl();
nl();
tleft(1);
npr("7[1Time left7] - 1%s\r\n",ctim(nsl()));
s1[0]=0;
if (udir[curdir].subnum==-1) {
curdir=0;
if (udir[curdir].subnum==-1) {
strcpy(s1,"() No Dirs Available :");
curdloads=0;
return;
}
}
if (s1[0]==0)
npr("1Dir 7(1%s7) 7(1%s7)\r\n",udir[curdir].keys,directories[udir[curdir].subnum].name);
outstr("1Command 7(> f");
helpl=2;
s=mmkey(1);
helpl=0;
if (s[0])
for (i=0; i<64; i++)
if (strcmp(udir[i].keys,s)==0)
curdir=i;
sysopchar(s);
if ((strcmp(s,"/?")==0) && (dcs()))
printmenu(8);
if ((strcmp(s,"UPLOADALL")==0) && (dcs())) {
i1=0;
for (i=0; (i<64) && (udir[i].subnum>=0) && (!i1); i++) {
nl();
nl();
outstr("Now uploading files for: ");
pl(directories[udir[i].subnum].name);
nl();
i1=uploadall(udir[i].subnum);
}
}
if ((strcmp(s,"UPLOAD")==0) && (dcs()))
uploadall(udir[curdir].subnum);
if ((strcmp(s,"UPLOADFILE")==0) && (so())) {
nl();
pl("1. PCB, RBBS - <filename> <size> <date> <description>");
pl("2. QBBS format - <filename> <description>");
nl();
prt(5,"Which format (1,2,Q) ? ");
ch=onek("Q12");
nl();
if (ch!='Q') {
outstr("Filename? ");
mpl(60);
inputl(s2,80);
switch(ch) {
case '1': i2=2; break;
case '2': i2=0; break;
default : i2=0; break;
}
upload_files(s2,udir[curdir].subnum,i2);
}
}
if ((strcmp(s,"REN")==0) && (dcs())) {
helpl=39;
rename_file();
}
if ((strcmp(s,"MOVE")==0) && (dcs()))
move_file();
if ((strcmp(s,"SORT")==0) && (dcs())) {
nl();
prt(2,"Sort all dirs? ");
i=yn();
nl();
prt(2,"Sort by date? ");
if (yn())
i1=2;
else
i1=0;
if (i)
sort_all(i1);
else
sortdir(udir[curdir].subnum,i1);
}
if ((strcmp(s,"RSORT")==0) && (dcs())) {
sort_all(1);
}
if ((s[1]==0) && (s[0]!=0)) {
switch(s[0]) {
case '>':
case '+':
if ((curdir<MAX_DIRS-2) && (udir[curdir+1].subnum>=0))
++curdir;
else
curdir=0;
break;
case '<':
case '-':
if (curdir>0)
--curdir;
else {
while ((udir[curdir+1].subnum>=0) && (curdir<MAX_DIRS-1))
++curdir;
}
break;
case '*': dirlist(); break;
case 'Q': curdloads=0; break;
case '.':
if (dcs()) {
m.stored_as=0L;
m.storage_type=255;
next=0;
read_message1(&m,0,0,&next,dszlog);
}
break;
case '?':
if ((sysstatus_expert & thisuser.sysstatus))
printmenu(3);
break;
case 'A':
helpl=23;
arc_l();
break;
case 'B':
helpl=22;
batchdl();
break;
case 'C':
reqchat();
break;
case 'D':
helpl=20;
if (usernum==133)
pl("Guest accounts cannot download");
else
download();
break;
case 'F':
helpl=21;
finddescription();
break;
case 'H':
if ((actsl==255) && (checkpw())) {
nl();
outstr("1PW 7> f");
echo=0;
input(s,20);
echo=1;
if (strcmp(s,("STEEPLE"))==0)
sysopmenu();
} else
pl("1You do not have access to that command");
break;
case 'L':
listfiles();
break;
case 'M':
helpl=31;
if (dcs())
move_file();
break;
case 'N':
abort=0;
nl();
prt(1,"Search all directories? ");
if (yn())
nscanall();
else {
nl();
nl();
nl();
nscandir(curdir,&abort,0);
}
break;
case 'G':
logoff1();
break;
case 'P':
helpl=13;
setldate();
break;
case 'R':
helpl=38;
removefile();
break;
case 'S':
searchall();
break;
case 'T':
helpl=32;
xfer_defaults();
break;
case 'U':
helpl=17;
if ((thisuser.restrict & (restrict_validate | restrict_upload)) ||
(syscfg.sysconfig & sysconfig_all_sysop)) {
if (syscfg.newuploads<num_dirs)
upload((int) syscfg.newuploads);
else
upload(0);
} else
upload(udir[curdir].subnum);
break;
case 'V':
helpl=23;
arc_l();
break;
case 'X':
helpl=22;
batchdl();
break;
case 'Y':
yourinfodl();
break;
case 'Z':
nl();
nl();
pl("1Sending file to sysop 7(> ");
nl();
helpl=17;
upload(0);
break;
}
}
helpl=0;
}
int date_changed()
{
struct date today,today1;
getdate(&today);
getdate(&today1);
if (today.da_day==today1.da_day)
return(0);
else
return(1);
}
void print_local_file(char *ss, char *ss1)
{
char s[81];
char s1[81];
if (syscfg.sysconfig & sysconfig_list) {
sprintf(s,"LIST %s%s",syscfg.gfilesdir,ss);
if (ss1[0]) {
sprintf(s1,"%s %s%s",s,syscfg.gfilesdir,ss1);
strcpy(s,s1);
}
do_remote(s,1);
} else {
printfile(ss);
nl();
nl();
getkey();
}
}
void getcaller()
{
char s[81],s1[81],ch,done,lokb;
int i,i1,i2,i3,any;
double d,d1;
long l,l1;
c_sub=c_dir=0;
frequent_init();
sl1(1,"");
imodem(0);
usernum=0;
wfc=0;
read_user(1,&thisuser);
usernum=1;
reset_act_sl();
fwaiting=thisuser.waiting;
if (thisuser.inact & inact_deleted) {
thisuser.screenchars=80;
thisuser.screenlines=25;
}
screenlinest=defscreenbottom+1;
d=(1.0+timer()) / 102.723;
d-=floor(d);
d*=10000.0;
srand((unsigned int)d);
do {
any=0;
wfc=1;
if (date_changed())
if (date_changed()) {
printf("\n\nClock Corrupted.\n\n");
printf("Should put BBS in a batch file like:\n\n");
printf("copy con: wwiv.bat\n");
printf(":top\n");
printf("setclock\n");
printf("bbs\n");
printf("if errorlevel 1 goto top\n");
printf("^Z\n");
end_bbs(noklevel);
}
check_event();
if (do_event) {
run_event();
any=1;
}
lokb=0;
strcpy(curspeed,"KB");
if ((!any) && ((rand() % 8000)==0) && (syscfg.systemnumber) &&
(ok_modem_stuff)) {
attempt_callout();
any=1;
}
okskey=0;
ch=upcase(inkey());
if (ch) {
any=1;
switch(ch) {
case '?':
if (ok_local()) {
printmenu(7);
nl();
getkey();
}
break;
case ' ':
outs("Log on? ");
d=timer();
while ((!kbhitb()) && (fabs(timer()-d)<60.0));
if (kbhitb()) {
ch=upcase(getchd1());
if (ch=='Y') {
outs("Yes\r\n");
lokb=1;
if ((syscfg.sysconfig & sysconfig_off_hook)==0)
dtr(0);
}
if ((ch=='F') && (ok_local())) {
outs("Fast\r\n\r\n\r\n\r\n\r\n\r\n");
read_user(1,&thisuser);
reset_act_sl();
if (thisuser.inact & inact_deleted) {
out1ch(12);
break;
}
lokb=2;
if ((syscfg.sysconfig & sysconfig_off_hook)==0)
dtr(0);
}
if (ch==0)
getchd1();
}
if (!lokb)
out1ch(12);
break;
case 'A':
if (!ok_modem_stuff)
break;
answer_phone();
break;
case 'B':
okskey=1;
if (ok_local()) {
holdphone(1);
boardedit();
holdphone(0);
}
okskey=0;
break;
case 'C':
okskey=1;
if (ok_local()) {
holdphone(1);
chainedit();
holdphone(0);
}
okskey=0;
break;
case 'D':
okskey=1;
if (ok_local()) {
holdphone(1);
dlboardedit();
holdphone(0);
}
okskey=0;
break;
case 'E':
okskey=1;
if (ok_local()) {
holdphone(1);
text_edit();
holdphone(0);
}
okskey=0;
break;
case 'F':
if (ok_local()) {
holdphone(1);
nl();
pl("Type \"EXIT\" to return to the BBS");
nl();
full_external(getenv("COMSPEC"),1,0);
out1ch(12);
cleanup_net();
holdphone(0);
}
break;
case 'G':
okskey=1;
if (ok_local()) {
holdphone(1);
gfileedit();
holdphone(0);
}
okskey=0;
break;
case 'I':
okskey=1;
if (ok_local()) {
holdphone(1);
ivotes();
holdphone(0);
}
okskey=0;
break;
case 'K':
if (ok_local()) {
usernum=1;
useron=1;
holdphone(1);
okskey=1;
prt(2,"Filename: ");
mpl(50);
input(s1,50);
load_workspace(s1,0);
send_email();
okskey=0;
useron=0;
write_user(1,&thisuser);
close_user();
cleanup_net();
holdphone(0);
}
break;
case 'L':
if (ok_local()) {
sl1(3,s1);
print_local_file(s1,status.log1);
}
break;
case 'M':
okskey=1;
if (ok_local()) {
holdphone(1);
mailr();
holdphone(0);
}
okskey=0;
break;
case 'N':
if (ok_local())
print_local_file("NET.LOG","");
break;
case 'P':
print_pending_list();
break;
case 'Q':
end_bbs(oklevel);
break;
case 'R':
if (ok_local()) {
usernum=1;
if (thisuser.waiting) {
holdphone(1);
okskey=1;
readmail();
okskey=0;
write_user(1,&thisuser);
close_user();
cleanup_net();
holdphone(0);
}
}
break;
case 'S':
if (ok_local()) {
prstatus();
getkey();
}
break;
case 'T':
if ((ok_local()) && (syscfg.terminal[0])) {
if (syscfg.sysconfig & sysconfig_shrink_term)
shrink_out(syscfg.terminal,0,0,0,1);
else
run_external(syscfg.terminal);
imodem(0);
}
break;
case 'U':
okskey=1;
if (ok_local()) {
holdphone(1);
uedit(1,0);
holdphone(0);
}
okskey=0;
break;
case 'W':
if (ok_local()) {
usernum=1;
useron=1;
holdphone(1);
okskey=1;
send_email();
okskey=0;
useron=0;
write_user(1,&thisuser);
close_user();
cleanup_net();
holdphone(0);
}
break;
case 'Y':
if (ok_local()) {
sl1(3,s1);
print_local_file(status.log1,s1);
}
break;
case 'Z':
if (ok_local()) {
zlog();
nl();
getkey();
}
break;
case '/':
if ((syscfg.systemnumber) && (ok_local()))
force_callout();
break;
}
if (!incom) {
frequent_init();
read_user(1,&thisuser);
fwaiting=thisuser.waiting;
reset_act_sl();
usernum=1;
}
okskey=0;
}
if ((comhit()) && (ok_modem_stuff) && (!lokb)) {
any=1;
if (peek1c()==10)
get1c();
else {
outs("* ");
if (mode_switch(1.0,0)==mode_ring)
answer_phone();
else if (modem_mode == mode_con) {
incom=outcom=1;
if (!(modem_flag & flag_ec))
wait1(45);
else
wait1(2);
}
}
}
if (!any) {
if (c_sub<num_subs) {
if (!sub_dates[c_sub]) {
any=1;
iscan_hash(c_sub);
}
c_sub++;
} else if (c_dir<num_dirs) {
if (!dir_dates[c_dir]) {
any=1;
dliscan_hash(c_dir);
}
c_dir++;
}
}
} while ((!incom) && (!lokb) && (!endday));
if (lokb)
modem_speed = modem_i->defl.modem_speed;
using_modem=incom;
if (lokb==2)
using_modem=-1;
okskey=1;
if (!endday) {
if (modem_mode==mode_fax)
sprintf(s,"\x0c""Fax connection at %s...\r\n",curspeed);
else
sprintf(s,"\x0cLogging on at %s...\r\n",curspeed);
outs(s);
}
wfc=0;
}
void gotcaller(unsigned int ms, unsigned int cs)
{
char s[81];
double d;
frequent_init();
com_speed = cs;
set_baud(cs);
modem_speed = ms;
sl1(1,"");
incom=1;
outcom=1;
read_user(1,&thisuser);
reset_act_sl();
usernum=1;
if (thisuser.inact & inact_deleted) {
thisuser.screenchars=80;
thisuser.screenlines=25;
}
screenlinest=25;
sprintf(s,"\x0cLogging on at %s...\r\n",curspeed);
outs(s);
using_modem=1;
d=(timer()) / 102.723;
d-=floor(d);
d*=10000.0;
srand((unsigned int)d);
}
void main(int argc, char *argv[])
{
char s[81],s1[81],ch,frc[81];
int i,i1,i2;
unsigned int ui, us;
double dt;
strcpy(s,getenv("BBS"));
if (strncmp(s,"WWIV",4)==0) {
printf("You are already in the BBS, type 'EXIT' instead.\n\n");
abort();
}
already_on=0;
endday=0;
oklevel=0;
noklevel=0;
ooneuser=0;
no_hangup=0;
ok_modem_stuff=1;
if (exist("restore.wwv"))
restoring_shrink=1;
else
restoring_shrink=0;
frc[0]=0;
/* /Brate /Srate /Nlevel /Alevel /O /H /M */
/* /B - someone already logged on at rate (modem speed)
/S - used only with /B, indicates com port speed
/N - normal exit level
/A - abnormal exit level
/O - quit WWIV after one user done
/H - don't hang up on user when he loggs off
/M - don't access modem at all
*/
for (i=1; i<argc; i++) {
strcpy(s,argv[i]);
if ((s[0]=='-') || (s[0]=='/')) {
ch=upcase(s[1]);
switch(ch) {
case 'B':
ui=(unsigned int) atol(&(s[2]));
if ((ui==300) || (ui==1200) || (ui==2400) || (ui==4800) ||
(ui==7200) || (ui==9600) || (ui==12000) || (ui==14400) ||
(ui==19200) || (ui==38400) || (ui==57600)) {
ultoa((unsigned long) ui,curspeed,10);
us=ui;
already_on=1;
} else {
ui=us=0;
}
break;
case 'F':
strcpy(frc,s+2);
strupr(frc);
already_on=1;
break;
case 'S':
us=(unsigned int) atol(&(s[2]));
if (!((us==300) || (us==1200) || (us==2400) || (us==4800) ||
(us==7200) || (us==9600) || (us==12000) || (us==14400) ||
(us==19200) || (us==38400) || (us==57600))) {
us=ui;
}
break;
case 'N':
oklevel=atoi(&(s[2]));
break;
case 'A':
noklevel=atoi(&(s[2]));
break;
case 'O':
ooneuser=1;
break;
case 'H':
no_hangup=1;
break;
case 'M':
ok_modem_stuff=0;
break;
}
}
}
init();
if (frc[0])
process_full_result(frc);
if (restoring_shrink) {
restoring_shrink=0;
switch(restore_data("restore.wwv")) {
case 0: /* WFC */
goto wfc_label;
case 1: /* main menu */
case 2:
goto main_menu_label;
}
}
do {
wait1(9);
if (already_on)
gotcaller(ui, us);
else
getcaller();
if (modem_mode==mode_fax) {
/* nothing here yet */
goto hanging_up;
}
if (using_modem>-1) {
if (!using_modem)
holdphone(1);
getuser();
} else {
holdphone(1);
using_modem=0;
checkit=0;
okmacro=1;
usernum=1;
reset_act_sl();
changedsl();
}
if (!hangup) {
logon();
goldflag=0;
thisuser.extratime=0;
main_menu_label:
while (!hangup) {
if (curdloads)
dlmainmenu();
else
mainmenu();
}
logoff();
}
hanging_up:
frequent_init();
if ((!no_hangup) && (using_modem) && ok_modem_stuff) {
dtr(0);
if (cdet()) {
wait1(9);
if (cdet()) {
wait1(9);
if (cdet()) {
i=0;
dtr(1);
while ((i++<2) && (cdet())) {
wait1(27);
pr1("\001\001\001");
wait1(54);
if (modem_i->hang[0])
pr1(modem_i->hang);
else
pr1("ATH\r");
wait1(6);
}
}
}
}
}
wfc_label:
cleanup_net();
if (!using_modem)
holdphone(0);
if ((!no_hangup) && ok_modem_stuff)
dtr(0);
already_on=0;
if (sysop_alert && (!kbhitb())) {
dtr(1);
wait1(2);
holdphone(1);
dt=timer();
clrscrb();
nl();
pl(">> SYSOP ALERT ACTIVATED <<");
nl();
while ((!kbhitb()) && (fabs(timer()-dt)<60.0)) {
setbeep(1);
wait1(9);
setbeep(0);
wait1(18);
}
clrscrb();
holdphone(0);
}
sysop_alert=0;
} while ((!endday) && (!ooneuser));
outs("\x0c");
end_bbs(oklevel);
}