home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
UTIL
/
WWIVE
/
OLDDEV.ARJ
/
BBS.C
< prev
next >
Wrap
Text File
|
1992-06-15
|
34KB
|
1,538 lines
/*****************************************************************************
WWIV Version 4
Copyright (C) 1988-1991 by Wayne Bell
Distribution of the source code for WWIV, in any form, modified or unmodified,
without PRIOR, WRITTEN APPROVAL by the author, is expressly prohibited.
Distribution of compiled versions of WWIV is limited to copies compiled BY
THE AUTHOR. Distribution of any copies of WWIV not compiled by the author
is expressly prohibited.
*****************************************************************************/
#pragma hdrstop
#define _DEFINE_GLOBALS_
#include "vars.h"
#include <math.h>
unsigned _stklen=15360;
#define modem_time 3.5
int checkpw()
{
char s[81];
nl();
prt(1,"SY3: ");
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 ansi_sublist()
{
int ok,i,abort,a,b,sam,tally;
char s[120],s1[50],s2[81];
abort=0;
nl();
pla("9 Num 7Type 1Description 5New Messages",&abort);
pla("3╔════╦═══════════╦══════════════════════════════════════════╤═════╗ ",&abort);
i=0;
while ((i<32) && (usub[i].subnum!=-1)) { /* Change 64 to 32 if not using */
/* Elrics 64 Sub Mod */
if (i>=1)
pla(s,&abort);
if (abort) break;
if (strcmp(usub[cursub].keys,usub[i].keys))
strcpy(s1,"Y"); else strcpy(s1,"N");
if (strcmp(s1,"Y"))
strcpy(s,"3║ 9");
else
strcpy(s,"3║ 9");
strcat(s,usub[i].keys); s[8]=0;
if (s[7]==0)
s[8]=32;
if (i<=8)
strcat(s," ");
if (strcmp(s1,"Y"))
strcat(s,"3 ║ "); else strcat(s," 3║ ");
if (strcmp(s1,"Y")) {
if (subboards[usub[i].subnum].type)
strcat(s,"7≡Network≡ 3║ 1");
else
strcat(s,"2 ····· 3║ 1");
} else {
if (subboards[usub[i].subnum].type)
strcat(s,"7≡Network≡ 3║ 1");
else
strcat(s,"2 ····· 3║ 1");
}
if (strcmp(subboards[usub[i].subnum].name,"THISUSER")==0) {
strcat(s,thisuser.realname);
strcat(s,"'s Sub ");
} else
strcat(s,subboards[usub[i].subnum].name);
a=(72-(strlen(s)));
for (b=0; b<a; b++) strcat(s," ");
if (strcmp(s1,"Y")) strcat(s,"3│5 "); else strcat(s,"3│5 ");
iscan(i);
sam=1;
while ((sam<=nummsgs) && (msgs[sam].qscan<=thisuser.qscnptr[usub[i].subnum]))
++sam;
sam=sam-1;
tally=nummsgs-sam;
strcat(s,(itoa(tally,s2,10)));
a=(81-(strlen(s)));
for (b=0;b<a;b++)
strcat(s," ");
if (strcmp(s1,"Y"))
strcat(s," 3║6You're here!");
else
strcat(s," 3║");
i++;}
pla(s,&abort);
pla("3╚════╩═══════════╩══════════════════════════════════════════╧═════╝ ",&abort);
if (i==0) pla("1None.",&abort);
nl();
}
void sublist()
{
int i,abort;
char s[80];
if (thisuser.sysstatus & sysstatus_ansi) {
ansi_sublist();
} else {
abort=0;
nl();
pla("Subs available: ",&abort);
nl();
i=0;
while ((i<32) && (usub[i].subnum!=-1)) { /* Change 64 to 32 in not */
strcpy(s,usub[i].keys); /* using Elrics 64 Sub Mod */
s[2]=0;
if (s[1]==0)
s[1]=32;
strcat(s," - ");
if (syscfg.systemnumber)
if (subboards[usub[i].subnum].type)
strcat(s,"<NET> ");
else
strcat(s," ");
strcat(s,subboards[usub[i].subnum].name);
pla(s,&abort);
i++;
}
if (i==0)
pla("None.",&abort);
nl();
}
}
void dirlist()
{
int i,abort;
char s[80];
abort=0;
nl();
pl("3╒═════════════════════════════════════════╕");
pla("3│ 1«3«7«1Dirs available7»3»1»5 3│ ",&abort);
pl("3╘═════════════════════════════════════════╛");
i=0;
while ((i<MAX_DIRS) && (udir[i].subnum!=-1)) {
sprintf(s,"5[3%2s5]7 -1 %s",udir[i].keys, directories[udir[i].subnum].name);
pla(s,&abort);
i++;
}
if (i==0)
pla("3None1.",&abort);
nl();
}
void text_edit()
{
char s[81],s1[81];
nl();
prt(3,"What's the filename1? ");
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("7Enter user's name or number1.");
helpl=14;
outstr("5:");
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("3Don't know1 '3em1.");
} 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("3Don't know1 '3em1.");
} 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 feedback()
{
char ch,s1[80];
nl();
printmenu(16);
ansic(1);
outstr("1() 3The Devil's Doorknob Feedback 1(> "); /* The name of your bbs here */
ch=onek("1234567EMQ"); /* Make sure each CASE '?' is listed here */
switch(ch) {
case '1':
strcpy(irt,"Feedback to Goddess"); /* This is your account */
email(1,0,0,0);
break;
case '2':
strcpy(irt,"Feedback to God"); /* These will be the RE:s */
email(2,0,0,0);
break;
case '3':
strcpy(irt,"Feedback to Remote SysOp ");
email(4,0,0,0); /* Change 1st number to account # */
break;
case '4':
strcpy(irt,"Net Coordinator Feedback ");
email(7,0,0,0);
break;
case '5':
strcpy(irt,"Feedback to Sysop that does nothing ");
email(56,0,0,0);
case 'Q':
break;
}
}
void mainmenu()
{
char *s, s1[81],s2[81];
int i;
long l;
if ((sysstatus_expert & thisuser.sysstatus)==0)
printmenu(0);
nl();
nl();
tleft(1);
npr("1Post7/1Call Ratio 3%-5.3f\r\n",post_ratio(),syscfg.post_call_ratio);
npr("7[1T7]1 -3 %s\r\n",ctim(nsl()));
s1[0]=0;
if (usub[cursub].subnum==-1) {
cursub=0;
if (usub[cursub].subnum==-1) {
strcpy(s1,"7[] 1No Subs Available5 :");
}
}
if (s1[0]==0)
sprintf(s1,"7[1%s7] [1%s7] 3:",usub[cursub].keys,subboards[usub[cursub].subnum].name);
prt(7,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 (so()) {
if (strcmp(s,"BOARDEDIT")==0) {
sysoplog("@ Ran Boardedit");
boardedit();
}
if (strcmp(s,"DIREDIT")==0) {
sysoplog("@ Ran Diredit");
dlboardedit();
}
if (strcmp(s,"CHAINEDIT")==0) {
sysoplog("@ Ran Chainedit");
chainedit();
}
if (strcmp(s,"GFILEEDIT")==0) {
sysoplog("@ Ran Gfileedit");
gfileedit();
}
if (strcmp(s,"DOS")==0) {
if (checkpw()) {
sysoplog("@ Molested DOS");
#ifdef OLD_STUFF
full_external(getenv("COMSPEC"),1,0);
#else
shrink_out(getenv("COMSPEC"),1,1,1,0);
#endif
topscreen();
}
}
if (strcmp(s,"RESETF")==0) {
reset_files();
}
if ((strcmp(s,"REBOOT")==0) && (checkpw())) {
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);
}
if (strcmp(s,"RELOAD")==0) {
read_new_stuff();
}
if ((strcmp(s,"EDIT")==0)) {
nl();
prt(1,"What's the filename5? ");
input(s1,50);
if (s1[0]) {
if ((okansi()) && (thisuser.defed))
external_edit(s1,"",thisuser.defed-1,500);
else
tedit(s1);
}
}
if (strcmp(s,"LOAD")==0) {
nl();
prt(1,"What's the filename5? ");
input(s1,50);
if (s1[0]) {
nl();
prt(3,"You wanna edit1? ");
if (yn()) {
nl();
load_workspace(s1,0);
} else {
nl();
load_workspace(s1,1);
}
}
}
if (strcmp(s,"CHUSER")==0) {
chuser();
}
if (strcmp(s,"STAT")==0) {
nl();
npr("1Stack size7:5 %d\r\n",_stklen);
npr("1Heap free7 :5 %dk\r\n", (int) (farcoreleft()/1024));
nl();
}
if (strcmp(s,"MAILR")==0) {
if (checkpw()) {
sysoplog("@ Read all mail");
mailr();
}
}
if (strcmp(s, "CHAT")==0) {
nl();
pl(((*(char far *)0x00000417L ^= 0x10) & 0x10) ?
"1You Bama3! 1Your gonna bother me3?" :
"3Sysop now unavailable");
sysoplog("@ Changed sysop avail status");
topscreen();
}
}
/**************************************************/
if (cs()) {
if (strcmp(s,"PENDING")==0) {
print_pending_list();
}
if (strcmp(s,"VOTEPRINT")==0) {
voteprint();
}
if (strcmp(s,"LOG")==0) {
sl1(3,s1);
printfile(s1);
}
if (strcmp(s,"YLOG")==0) {
printfile(status.log1);
}
if (strcmp(s,"NLOG")==0) {
printfile("NET.LOG");
}
if (strcmp(s,"UEDIT")==0) {
sysoplog("@ Ran Uedit");
uedit(usernum,0);
}
if (strcmp(s,"STATUS")==0) {
prstatus();
}
if (strcmp(s,"IVOTES")==0) {
sysoplog("@ Ran Ivotes");
ivotes();
}
if (strcmp(s,"ZLOG")==0) {
zlog();
}
if (strcmp(s,"TEDIT")==0) {
sysoplog("@ Ran Tedit");
text_edit();
}
if (strcmp(s,"/?")==0) {
printmenu(5);
}
}
/*************************************************/
if ((strcmp(s,"UPLOAD")==0) && (actsl>10))
upload_post();
if (strcmp(s,"QSCAN")==0) {
nl();
prt(6,"Clear 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("6Q-Scan pointers cleared.");
nl();
}
}
if (strcmp(s,"CLS")==0)
outstr("\x0c");
if (strcmp(s,"/O")==0)
hangup=1;
if (strcmp(s,"/E")==0)
slash_e();
if (strcmp(s,"/N")==0)
nscan(cursub);
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,"VER")==0) {
nl();
pl(VERSION_NUMBER);
nl();
pl("1The author may be contacted at3:");
nl();
pl(" 1 Wayne 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 '>':
case '+':
if ((cursub<MAX_SUBS-2) && (usub[cursub+1].subnum>=0))
++cursub;
else
cursub=0;
break;
case '<':
case '-':
if (cursub>0)
--cursub;
else {
while ((usub[cursub+1].subnum>=0) && (cursub<MAX_SUBS-1))
++cursub;
}
break;
case '!':
helpl=14;
if (!cs())
return;
nl();
nl();
pl("7Enter user's name or number1.");
outstr("5:");
input(s1,30);
i=finduser1(s1);
if (i>0) {
sysoplog("@ Validated user");
valuser(i);
} else
pl("3Don't know 'em1.");
break;
case '.':
if (thisuser.ass_pts>=15){
npr("1You have too many cass 1points to play games");
break;}
game_ratio();
break;
case 'A':
helpl=19;
write_automessage();
break;
case 'B':
helpl=25;
bbslist();
break;
case 'C':
helpl=3;
reqchat();
break;
case 'D':
helpl=4;
defaults();
break;
case 'E':
send_email();
break;
case 'F':
strcpy(irt,"3Feedback1.");
feedback();
break;
case 'G':
helpl=28;
gfiles();
break;
case 'I':
nl();
pl(VERSION_NUMBER);
nl();
printfile("LOGON");
printfile("SYSTEM");
break;
case 'K':
helpl=8;
kill_old_email();
break;
case 'L':
pl("5╔═══════════════════════════════════════╗");
pl("5║7Call # 3Alias 7Baud 2#5║");
pl("5╚═══════════════════════════════════════╝");
printfile("USER.LOG");
pl("5═════════════════════════════════════════");
break;
case 'M':
if (thisuser.waiting>0) {
readmail();
} else {
nl();
pl("7Haha1!7 You have no Mail1!");
nl();
}
break;
case 'N':
express=0;
expressabort=0;
nscan(0);
break;
case 'O':
nl();
nl();
prt(3,"Leaving so soon1? ");
helpl=12;
if (yn()) {
outchr(12);
npr("Time on = %s\r\n",ctim(timer()-timeon));
printfile("LOGOFF");
hangup=1;
}
break;
case 'P':
irt[0]=0;
irt_name[0]=0;
if (usub[0].subnum!=-1)
post();
break;
case 'Q':
i=0;
express=0;
expressabort=0;
qscan(cursub,&i);
break;
case 'R':
helpl=15;
remove_post();
break;
case 'S':
express=0;
expressabort=0;
scan2();
break;
case 'T':
if (thisuser.ass_pts>=15){
npr("1You have too many cass 1points to transfer");
break;}
printmenu(15);
if (syscfg.sysconfig & sysconfig_no_xfer) {
nl();
pl("6Sorry, the transfer section has been closed by the sysop.");
nl();
break;
}
if (udir[0].subnum!=-1)
curdloads=1;
else {
nl();
pl("6Sorry, you can't get to the files.");
nl();
}
break;
case 'U':
list_users();
break;
case 'V':
helpl=18;
vote();
break;
case 'X':
thisuser.sysstatus ^= sysstatus_expert;
break;
case 'Y':
yourinfo();
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(0);
break;
case '*': sublist(); 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("1Post7/1Call Ratio 3%-5.3f\r\n",post_ratio(),syscfg.post_call_ratio);
npr("7[1T7]1 -3 %s\r\n",ctim(nsl()));
s1[0]=0;
if (udir[curdir].subnum==-1) {
curdir=0;
if (udir[curdir].subnum==-1) {
strcpy(s1,"7() 1No Dirs Available3 :");
curdloads=0;
return;
}
}
if (s1[0]==0)
sprintf(s1,"7[1%s7]1-7[1%s7]3 :",udir[curdir].keys,directories[udir[curdir].subnum].name);
prt(3,s1);
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,"/O")==0)
hangup=1;
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("3Now uploading files for1: ");
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("1What's the filename3? ");
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(6,"Sort all dirs? ");
i=yn();
nl();
prt(6,"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 ((strcmp(s,"DIREDIT")==0) && (so())) {
sysoplog("@ Ran Diredit");
dlboardedit();
}
if ((strcmp(s,"DOS")==0) && (so())) {
if (checkpw()) {
sysoplog("@ Molested DOS");
#ifdef OLD_STUFF
full_external(getenv("COMSPEC"),1,0);
#else
shrink_out(getenv("COMSPEC"),1,1,1,0);
#endif
topscreen();
}
}
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':
helpl=3;
reqchat();
break;
case 'D':
helpl=20;
download();
break;
case 'E':
helpl=29;
temp_extract();
break;
case 'F':
helpl=21;
finddescription();
break;
case 'G':
helpl=30;
temporary_stuff();
break;
case 'L':
listfiles();
break;
case 'M':
helpl=31;
if (dcs())
move_file();
break;
case 'N':
abort=0;
nl();
prt(6,"Search all directories? ");
if (yn())
nscanall();
else {
nl();
nl();
nl();
nscandir(curdir,&abort,1);
}
break;
case 'O':
helpl=12;
nl();
nl();
prt(1,"Leaving so soon3? ");
if (yn()) {
outchr(12);
npr("Time on = %s\r\n",ctim(timer()-timeon));
printfile("LOGOFF");
hangup=1;
}
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("6Sending file to sysop :-");
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(1,"Filename ");
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;
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;
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;
/* /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==9600) || (ui==19200) ||
(ui==38400) || (ui==57600)) {
ultoa((unsigned long) ui,curspeed,10);
us=ui;
already_on=1;
} else {
ui=us=0;
}
break;
case 'S':
us=(unsigned int) atol(&(s[2]));
if (!((us==300) || (us==1200) || (us==2400) || (us==9600) || (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(1);
if (restoring_shrink) {
restoring_shrink=0;
switch(restore_data("restore.wwv")) {
case 0: /* WFC */
goto wfc_label;
case 1: /* main menu */
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();
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);
}