Switched to detected screensize

This commit is contained in:
Michiel Broek 2005-10-07 20:42:35 +00:00
parent 4122c4f309
commit 0f69e97f44
20 changed files with 253 additions and 242 deletions

View File

@ -1027,7 +1027,7 @@ struct sysconfig {
unsigned GiveEmail : 1; /* Give user email */ unsigned GiveEmail : 1; /* Give user email */
unsigned AskAddress : 1; /* Ask Home Address */ unsigned AskAddress : 1; /* Ask Home Address */
unsigned iOneName : 1; /* Allow one user name */ unsigned iOneName : 1; /* Allow one user name */
unsigned AskScreenlen : 1; /* Ask screenlength */ unsigned xAskScreenlen : 1;
unsigned iCrashLevel; /* User level for crash mail*/ unsigned iCrashLevel; /* User level for crash mail*/
unsigned iAttachLevel; /* User level for fileattach*/ unsigned iAttachLevel; /* User level for fileattach*/

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Users Database structure * Purpose ...............: MBSE BBS Users Database structure
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -112,7 +112,7 @@ struct userrec {
int iTimeLeft; /* Time left today */ int iTimeLeft; /* Time left today */
int iConnectTime; /* Connect time this call */ int iConnectTime; /* Connect time this call */
int iTimeUsed; /* Time used today */ int iTimeUsed; /* Time used today */
int iScreenLen; /* User Screen Length */ int xScreenLen;
time_t tLastPwdChange; /* Date last password chg */ time_t tLastPwdChange; /* Date last password chg */
unsigned xHangUps; unsigned xHangUps;
long Credit; /* Users credit */ long Credit; /* Users credit */

View File

@ -203,7 +203,10 @@ void Help()
void die(int onsig) void die(int onsig)
{ {
signal(onsig, SIG_IGN); if (onsig && (onsig <= NSIG)) {
signal(onsig, SIG_IGN);
}
if (!do_quiet) { if (!do_quiet) {
printf("\r"); printf("\r");
mbse_colour(CYAN, BLACK); mbse_colour(CYAN, BLACK);
@ -221,9 +224,6 @@ void die(int onsig)
WriteError("Terminated with error %d", onsig); WriteError("Terminated with error %d", onsig);
} }
if (onsig == SIGSEGV)
Syslog('+', "Last msg area %s", msgs.Name);
if (are_tot || are_proc || msg_link) if (are_tot || are_proc || msg_link)
Syslog('+', "Areas [%6d] Processed [%6d] Linked [%6d]", are_tot, are_proc, msg_link); Syslog('+', "Areas [%6d] Processed [%6d] Linked [%6d]", are_tot, are_proc, msg_link);
if (msg_tot || msg_del) if (msg_tot || msg_del)

View File

@ -49,6 +49,9 @@ char rbuf[50][81]; /* Chat receive buffer */ /* FIXME: must be a dynamic b
int rpointer = 0; /* Chat receive pointer */ int rpointer = 0; /* Chat receive pointer */
int rsize = 5; /* Chat receive size */ int rsize = 5; /* Chat receive size */
extern pid_t mypid; extern pid_t mypid;
extern int cols;
extern int rows;
void Showline(int, int, char *); void Showline(int, int, char *);
@ -168,7 +171,7 @@ void Chat(char *username, char *channel)
WhosDoingWhat(SYSOPCHAT, NULL); WhosDoingWhat(SYSOPCHAT, NULL);
clear(); clear();
rsize = exitinfo.iScreenLen - 5; rsize = rows - 5;
rpointer = 0; rpointer = 0;
if (SYSOP == TRUE) { if (SYSOP == TRUE) {
@ -205,7 +208,7 @@ void Chat(char *username, char *channel)
locate(1, 1); locate(1, 1);
colour(WHITE, BLUE); colour(WHITE, BLUE);
clrtoeol(); clrtoeol();
snprintf(buf, 200, "%-*s", 79, " MBSE BBS Chat Server"); snprintf(buf, 200, "%-*s", cols -1, " MBSE BBS Chat Server");
mvprintw(1, 1, buf); mvprintw(1, 1, buf);
snprintf(buf, 200, "CCON,4,%d,%s,%s,0;", mypid, exitinfo.sUserName, exitinfo.Name); snprintf(buf, 200, "CCON,4,%d,%s,%s,0;", mypid, exitinfo.sUserName, exitinfo.Name);
@ -224,14 +227,14 @@ void Chat(char *username, char *channel)
} }
} }
locate(exitinfo.iScreenLen - 2, 1); locate(rows - 2, 1);
colour(WHITE, BLUE); colour(WHITE, BLUE);
clrtoeol(); clrtoeol();
snprintf(buf, 200, "%-*s", 79, " Chat, type \"/EXIT\" to exit or \"/HELP\" for help"); snprintf(buf, 200, "%-*s", cols -1, " Chat, type \"/EXIT\" to exit or \"/HELP\" for help");
mvprintw(exitinfo.iScreenLen - 2, 1, buf); mvprintw(rows - 2, 1, buf);
colour(LIGHTGRAY, BLACK); colour(LIGHTGRAY, BLACK);
mvprintw(exitinfo.iScreenLen - 1, 1, ">"); mvprintw(rows - 1, 1, ">");
memset(&sbuf, 0, sizeof(sbuf)); memset(&sbuf, 0, sizeof(sbuf));
memset(&rbuf, 0, sizeof(rbuf)); memset(&rbuf, 0, sizeof(rbuf));
@ -290,7 +293,7 @@ void Chat(char *username, char *channel)
* Check for a pressed key, if so then process it. * Check for a pressed key, if so then process it.
* Allow hi-ascii for multi-language. * Allow hi-ascii for multi-language.
*/ */
ch = testkey(exitinfo.iScreenLen -1, curpos + 2); ch = testkey(rows -1, curpos + 2);
if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) { if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) {
alarm_on(); alarm_on();
if (curpos) { if (curpos) {
@ -333,9 +336,9 @@ void Chat(char *username, char *channel)
} }
curpos = 0; curpos = 0;
memset(&sbuf, 0, sizeof(sbuf)); memset(&sbuf, 0, sizeof(sbuf));
locate(exitinfo.iScreenLen - 1, 2); locate(rows - 1, 2);
clrtoeol(); clrtoeol();
mvprintw(exitinfo.iScreenLen - 1, 1, ">"); mvprintw(rows - 1, 1, ">");
} }
} }
chatting = FALSE; chatting = FALSE;

View File

@ -50,6 +50,10 @@
#include "ttyio.h" #include "ttyio.h"
extern int rows;
/* /*
* Function returns total number of bbs users * Function returns total number of bbs users
*/ */
@ -184,7 +188,7 @@ int DisplayTextFile(char *filename)
Enter(1); Enter(1);
lc++; lc++;
if ((lc >= exitinfo.iScreenLen) && (lc < 1000)) { if ((lc >= rows) && (lc < 1000)) {
lc = 0; lc = 0;
/* More (Y/n/=) */ /* More (Y/n/=) */
pout(CFG.MoreF, CFG.MoreB, (char *) Language(61)); pout(CFG.MoreF, CFG.MoreB, (char *) Language(61));
@ -467,7 +471,7 @@ void ControlCodeU(int ch)
break; break;
case 'M': case 'M':
snprintf(temp, 81, "%d", exitinfo.iScreenLen); snprintf(temp, 81, "%d", rows);
break; break;
case 'N': case 'N':

View File

@ -46,7 +46,8 @@
extern time_t t_start; extern time_t t_start;
extern int e_pid; extern int e_pid;
extern char **environ; extern char **environ;
extern int cols;
extern int rows;
char *Gdate(time_t, int); char *Gdate(time_t, int);
@ -220,7 +221,7 @@ void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSu
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft * 60); /* Seconds */ fprintf(fp, "%d\r\n", exitinfo.iTimeLeft * 60); /* Seconds */
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft); /* Minutes */ fprintf(fp, "%d\r\n", exitinfo.iTimeLeft); /* Minutes */
fprintf(fp, "%s\r\n", exitinfo.GraphMode?"GR":"NG"); /* Graphics GR,RIP,NG */ fprintf(fp, "%s\r\n", exitinfo.GraphMode?"GR":"NG"); /* Graphics GR,RIP,NG */
fprintf(fp, "%d\r\n", exitinfo.iScreenLen); fprintf(fp, "%d\r\n", rows);
fprintf(fp, "N\r\n"); /* User mode, always N */ fprintf(fp, "N\r\n"); /* User mode, always N */
fprintf(fp, "\r\n"); /* Always blank */ fprintf(fp, "\r\n"); /* Always blank */
fprintf(fp, "\r\n"); /* Always blank */ fprintf(fp, "\r\n"); /* Always blank */

View File

@ -51,10 +51,10 @@
extern long arecno; /* File area number in xxxScan() functions */ extern long arecno; /* File area number in xxxScan() functions */
int Strlen = 0; int Strlen = 0;
int FileRecno = 0; int FileRecno = 0;
extern int rows;
int CheckFile(char *, int); int CheckFile(char *, int);
@ -461,7 +461,7 @@ void File_RawDir(char *OpData)
Enter(1); Enter(1);
LineCount++; LineCount++;
if (LineCount == exitinfo.iScreenLen) { if (LineCount == rows) {
Pause(); Pause();
LineCount = 0; LineCount = 0;
} }
@ -1430,7 +1430,7 @@ void FileArea_List(char *Option)
Recno++; Recno++;
if ((iAreaCount / 2) == exitinfo.iScreenLen) { if ((iAreaCount / 2) == rows) {
/* More (Y/n/=/Area #): */ /* More (Y/n/=/Area #): */
pout(CFG.MoreF, CFG.MoreB, (char *) Language(207)); pout(CFG.MoreF, CFG.MoreB, (char *) Language(207));
/* /*

View File

@ -48,6 +48,7 @@
extern pid_t mypid; extern pid_t mypid;
long arecno = 1; /* Area record number */ long arecno = 1; /* Area record number */
int Hcolor = 9; /* Color of area line in xxxScan() functions */ int Hcolor = 9; /* Color of area line in xxxScan() functions */
extern int rows;
/* /*
@ -309,7 +310,7 @@ int iLC(int Lines)
x = strlen(Language(131)); x = strlen(Language(131));
iLineCount += Lines; iLineCount += Lines;
if ((iLineCount >= exitinfo.iScreenLen) && (iLineCount < 1000)) { if ((iLineCount >= rows) && (iLineCount < 1000)) {
iLineCount = 0; iLineCount = 0;
while (TRUE) { while (TRUE) {

View File

@ -42,6 +42,10 @@
#include "ttyio.h" #include "ttyio.h"
extern int cols;
extern int rows;
void Show_Ins(void) void Show_Ins(void)
{ {
locate(1, 70); locate(1, 70);
@ -180,7 +184,7 @@ void Refresh(void)
colour(CFG.TextColourF, CFG.TextColourB); colour(CFG.TextColourF, CFG.TextColourB);
for (i = 1; i <= Line; i++) { for (i = 1; i <= Line; i++) {
if ((i >= TopVisible) && (i < (TopVisible + exitinfo.iScreenLen -1))) { if ((i >= TopVisible) && (i < (TopVisible + rows -1))) {
locate(j, 1); locate(j, 1);
j++; j++;
PUTSTR(Message[i]); PUTSTR(Message[i]);
@ -259,13 +263,13 @@ void FsMove(unsigned char Direction)
* Handle long lines better. * Handle long lines better.
* For now, we will just refuse to go past col 80 * For now, we will just refuse to go past col 80
*/ */
if ((Col <= strlen(Message[CurRow])) && (Col < 80)){ if ((Col <= strlen(Message[CurRow])) && (Col < cols)){
Col++; Col++;
Setcursor(); Setcursor();
} else if (Row < (Line - TopVisible +1)) { } else if (Row < (Line - TopVisible +1)) {
Row++; Row++;
Col = 1; Col = 1;
if (Row > (exitinfo.iScreenLen -1)) ScrollDown(); if (Row > (rows -1)) ScrollDown();
Refresh(); Refresh();
} else } else
Beep(); Beep();
@ -282,8 +286,8 @@ void FsMove(unsigned char Direction)
* Handle long lines better. * Handle long lines better.
* For now, we will just refuse to go past col 80 * For now, we will just refuse to go past col 80
*/ */
if (Col > 80) if (Col > cols)
Col = 80; Col = cols;
if (Row == 1) if (Row == 1)
ScrollUp(); ScrollUp();
Row--; Row--;
@ -310,7 +314,7 @@ void FsMove(unsigned char Direction)
Row++; Row++;
if (Col > strlen(Message[CurRow+1]) + 1) if (Col > strlen(Message[CurRow+1]) + 1)
Col = strlen(Message[CurRow+1]) + 1; Col = strlen(Message[CurRow+1]) + 1;
if (Row <= (exitinfo.iScreenLen -1)) if (Row <= (rows -1))
Setcursor(); Setcursor();
else else
ScrollDown(); ScrollDown();
@ -339,10 +343,10 @@ int FsWordWrap()
WCol = 79; WCol = 79;
while (Message[CurRow][WCol] != ' ' && WCol > 0) while (Message[CurRow][WCol] != ' ' && WCol > 0)
WCol--; WCol--;
if ((WCol > 0) && (WCol < 80)) if ((WCol > 0) && (WCol < cols))
WCol++; WCol++;
else else
WCol=80; WCol=cols;
if (WCol <= strlen(Message[CurRow])) { if (WCol <= strlen(Message[CurRow])) {
/* /*
* If WCol = 80 (no spaces in line) be sure to grab * If WCol = 80 (no spaces in line) be sure to grab
@ -445,7 +449,7 @@ int Fs_Edit()
Line++; Line++;
Row++; Row++;
Col = 1; Col = 1;
if (Row >= (exitinfo.iScreenLen -1)) if (Row >= (rows -1))
ScrollDown(); ScrollDown();
Refresh(); Refresh();
Changed = TRUE; Changed = TRUE;
@ -756,7 +760,7 @@ int Fs_Edit()
Col--; Col--;
Row++; Row++;
} }
if (Row > (exitinfo.iScreenLen -1)) if (Row > (rows -1))
ScrollDown(); ScrollDown();
else else
Refresh(); Refresh();

View File

@ -45,7 +45,7 @@ extern pid_t mypid; /* Original pid */
void UserSilent(int flag) void UserSilent(int flag)
{ {
SockS("ADIS:2,%d,%d;", mypid, flag); SockS("ADIS:2,%d,%d;", mypid, flag);
} }
@ -60,7 +60,7 @@ int CheckStatus()
snprintf(buf, 81, "SBBS:0;"); snprintf(buf, 81, "SBBS:0;");
if (socket_send(buf) == 0) { if (socket_send(buf) == 0) {
strcpy(buf, socket_receive()); strncpy(buf, socket_receive(), 80);
if (strncmp(buf, "100:2,0", 7) == 0) if (strncmp(buf, "100:2,0", 7) == 0)
return TRUE; return TRUE;
if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh)) if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh))
@ -179,112 +179,112 @@ int CheckUnixNames(char *name)
*/ */
char *ChangeHomeDir(char *Name, int Mailboxes) char *ChangeHomeDir(char *Name, int Mailboxes)
{ {
char *temp; char *temp;
static char temp1[PATH_MAX]; static char temp1[PATH_MAX];
FILE *fp; FILE *fp;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
/* /*
* set umask bits to zero's then reset with mkdir * set umask bits to zero's then reset with mkdir
*/ */
umask(000); umask(000);
/*
* First check to see if users home directory exists
* else try create directory, as set in CFG.bbs_usersdir
*/
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
free(temp);
ExitClient(MBERR_INIT_ERROR);
}
snprintf(temp1, PATH_MAX, "%s/%s", CFG.bbs_usersdir, Name);
/*
* Then check to see if users directory exists in the home dir
*/
if ((access(temp1, R_OK)) != 0) {
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
free(temp);
ExitClient(MBERR_INIT_ERROR);
}
/*
* Change to users home directory
*/
if (chdir(temp1) != 0) {
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
free(temp);
ExitClient(MBERR_INIT_ERROR);
}
setenv("HOME", temp1, 1);
/*
* Check if user has a .signature file.
* If not, create a simple one.
*/
snprintf(temp, PATH_MAX, "%s/%s/.signature", CFG.bbs_usersdir, Name);
if (access(temp, R_OK)) {
Syslog('+', "Creating users .signature file");
if ((fp = fopen(temp, "w")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
fprintf(fp, " Greetings, %s\n", exitinfo.sUserName);
if ((CFG.EmailMode == E_PRMISP) && exitinfo.Email && CFG.GiveEmail)
fprintf(fp, " email: %s@%s\n", exitinfo.Name, CFG.sysdomain);
fclose(fp);
}
}
/*
* Check subdirectories, create them if they don't exist.
*/
snprintf(temp, PATH_MAX, "%s/wrk", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/tag", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/upl", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/tmp", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/.dosemu", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/.dosemu/run", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/.dosemu/tmp", temp1);
CheckDir(temp);
umask(007);
/*
* Check users private emailboxes
*/
if (Mailboxes) {
snprintf(temp, PATH_MAX, "%s/mailbox", temp1);
if (Msg_Open(temp))
Msg_Close();
snprintf(temp, PATH_MAX, "%s/archive", temp1);
if (Msg_Open(temp))
Msg_Close();
snprintf(temp, PATH_MAX, "%s/trash", temp1);
if (Msg_Open(temp))
Msg_Close();
}
/*
* First check to see if users home directory exists
* else try create directory, as set in CFG.bbs_usersdir
*/
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
free(temp); free(temp);
return temp1; ExitClient(MBERR_INIT_ERROR);
}
snprintf(temp1, PATH_MAX, "%s/%s", CFG.bbs_usersdir, Name);
/*
* Then check to see if users directory exists in the home dir
*/
if ((access(temp1, R_OK)) != 0) {
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
free(temp);
ExitClient(MBERR_INIT_ERROR);
}
/*
* Change to users home directory
*/
if (chdir(temp1) != 0) {
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
free(temp);
ExitClient(MBERR_INIT_ERROR);
}
setenv("HOME", temp1, 1);
/*
* Check if user has a .signature file.
* If not, create a simple one.
*/
snprintf(temp, PATH_MAX, "%s/%s/.signature", CFG.bbs_usersdir, Name);
if (access(temp, R_OK)) {
Syslog('+', "Creating users .signature file");
if ((fp = fopen(temp, "w")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
fprintf(fp, " Greetings, %s\n", exitinfo.sUserName);
if ((CFG.EmailMode == E_PRMISP) && exitinfo.Email && CFG.GiveEmail)
fprintf(fp, " email: %s@%s\n", exitinfo.Name, CFG.sysdomain);
fclose(fp);
}
}
/*
* Check subdirectories, create them if they don't exist.
*/
snprintf(temp, PATH_MAX, "%s/wrk", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/tag", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/upl", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/tmp", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/.dosemu", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/.dosemu/run", temp1);
CheckDir(temp);
snprintf(temp, PATH_MAX, "%s/.dosemu/tmp", temp1);
CheckDir(temp);
umask(007);
/*
* Check users private emailboxes
*/
if (Mailboxes) {
snprintf(temp, PATH_MAX, "%s/mailbox", temp1);
if (Msg_Open(temp))
Msg_Close();
snprintf(temp, PATH_MAX, "%s/archive", temp1);
if (Msg_Open(temp))
Msg_Close();
snprintf(temp, PATH_MAX, "%s/trash", temp1);
if (Msg_Open(temp))
Msg_Close();
}
free(temp);
return temp1;
} }
void CheckDir(char *dir) void CheckDir(char *dir)
{ {
if ((access(dir, R_OK) != 0)) { if ((access(dir, R_OK) != 0)) {
Syslog('+', "Creating %s", dir); Syslog('+', "Creating %s", dir);
if (mkdir(dir, 0770)) if (mkdir(dir, 0770))
WriteError("$Can't create %s", dir); WriteError("$Can't create %s", dir);
} }
} }
@ -295,42 +295,42 @@ void CheckDir(char *dir)
*/ */
void FindMBSE() void FindMBSE()
{ {
FILE *pDataFile; FILE *pDataFile;
static char p[81]; static char p[81];
char *FileName; char *FileName;
struct passwd *pw; struct passwd *pw;
FileName = calloc(PATH_MAX, sizeof(char)); FileName = calloc(PATH_MAX, sizeof(char));
/* /*
* Check if the environment is set, if not, then we create the * Check if the environment is set, if not, then we create the
* environment from the passwd file. * environment from the passwd file.
*/ */
if (getenv("MBSE_ROOT") == NULL) { if (getenv("MBSE_ROOT") == NULL) {
pw = getpwnam("mbse"); pw = getpwnam("mbse");
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
snprintf(p, 81, "MBSE_ROOT=%s", pw->pw_dir); snprintf(p, 81, "MBSE_ROOT=%s", pw->pw_dir);
putenv(p); putenv(p);
} }
if (getenv("MBSE_ROOT") == NULL) { if (getenv("MBSE_ROOT") == NULL) {
printf("FATAL ERROR: Environment variable MBSE_ROOT not set\n"); printf("FATAL ERROR: Environment variable MBSE_ROOT not set\n");
free(FileName);
exit(MBERR_INIT_ERROR);
}
snprintf(FileName, PATH_MAX, "%s/etc/config.data", getenv("MBSE_ROOT"));
if(( pDataFile = fopen(FileName, "rb")) == NULL) {
printf("FATAL ERROR: Can't open %s for reading!\n", FileName);
printf("Please run mbsetup to create configuration file.\n");
printf("Or check that your environment variable MBSE_ROOT is set to the BBS Path!\n");
free(FileName);
exit(MBERR_CONFIG_ERROR);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);
free(FileName); free(FileName);
fclose(pDataFile); exit(MBERR_INIT_ERROR);
}
snprintf(FileName, PATH_MAX, "%s/etc/config.data", getenv("MBSE_ROOT"));
if (( pDataFile = fopen(FileName, "rb")) == NULL) {
printf("FATAL ERROR: Can't open %s for reading!\n", FileName);
printf("Please run mbsetup to create configuration file.\n");
printf("Or check that your environment variable MBSE_ROOT is set to the BBS Path!\n");
free(FileName);
exit(MBERR_CONFIG_ERROR);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);
free(FileName);
fclose(pDataFile);
} }
@ -340,50 +340,25 @@ void FindMBSE()
*/ */
char *GetMonth(int Month) char *GetMonth(int Month)
{ {
static char month[10]; static char month[10];
switch (Month) { switch (Month) {
case 1: case 1: strcpy(month, *(mLanguage + 398)); break;
strcpy(month, *(mLanguage + 398)); case 2: strcpy(month, *(mLanguage + 399)); break;
break; case 3: strcpy(month, *(mLanguage + 400)); break;
case 2: case 4: strcpy(month, *(mLanguage + 401)); break;
strcpy(month, *(mLanguage + 399)); case 5: strcpy(month, *(mLanguage + 402)); break;
break; case 6: strcpy(month, *(mLanguage + 403)); break;
case 3: case 7: strcpy(month, *(mLanguage + 404)); break;
strcpy(month, *(mLanguage + 400)); case 8: strcpy(month, *(mLanguage + 405)); break;
break; case 9: strcpy(month, *(mLanguage + 406)); break;
case 4: case 10: strcpy(month, *(mLanguage + 407)); break;
strcpy(month, *(mLanguage + 401)); case 11: strcpy(month, *(mLanguage + 408)); break;
break; case 12: strcpy(month, *(mLanguage + 409)); break;
case 5: default: strcpy(month, "Unknown");
strcpy(month, *(mLanguage + 402)); }
break;
case 6:
strcpy(month, *(mLanguage + 403));
break;
case 7:
strcpy(month, *(mLanguage + 404));
break;
case 8:
strcpy(month, *(mLanguage + 405));
break;
case 9:
strcpy(month, *(mLanguage + 406));
break;
case 10:
strcpy(month, *(mLanguage + 407));
break;
case 11:
strcpy(month, *(mLanguage + 408));
break;
case 12:
strcpy(month, *(mLanguage + 409));
break;
default:
strcpy(month, "Unknown");
}
return(month); return(month);
} }
@ -391,19 +366,19 @@ char *GetMonth(int Month)
/* Returns DD-Mmm-YYYY */ /* Returns DD-Mmm-YYYY */
char *GLCdateyy() char *GLCdateyy()
{ {
static char GLcdateyy[15]; static char GLcdateyy[15];
char ntime[15]; char ntime[15];
Time_Now = time(NULL); Time_Now = time(NULL);
l_date = localtime(&Time_Now); l_date = localtime(&Time_Now);
snprintf(GLcdateyy, 15, "%02d-", l_date->tm_mday); snprintf(GLcdateyy, 15, "%02d-", l_date->tm_mday);
snprintf(ntime, 15, "-%02d", l_date->tm_year+1900); snprintf(ntime, 15, "-%02d", l_date->tm_year+1900);
strcat(GLcdateyy, GetMonth(l_date->tm_mon+1)); strcat(GLcdateyy, GetMonth(l_date->tm_mon+1));
strcat(GLcdateyy,ntime); strcat(GLcdateyy,ntime);
return(GLcdateyy); return (GLcdateyy);
} }

View File

@ -49,6 +49,8 @@ extern int LC_Wrote;
extern int LC_Chat; extern int LC_Chat;
extern int LC_Olr; extern int LC_Olr;
extern int LC_Door; extern int LC_Door;
extern int rows;
extern int cols;
@ -81,7 +83,7 @@ void LastCallers(char *OpData)
x = strlen(Heading); x = strlen(Heading);
for(i = 0; i < x; i++) for (i = 0; i < x; i++)
snprintf(Underline, 81, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45); snprintf(Underline, 81, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(LIGHTRED, BLACK); colour(LIGHTRED, BLACK);
@ -94,7 +96,7 @@ void LastCallers(char *OpData)
Enter(1); Enter(1);
colour(GREEN, BLACK); colour(GREEN, BLACK);
fLine(79); fLine(cols -1);
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) { while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if (!lcall.Hidden) { if (!lcall.Hidden) {
@ -131,7 +133,7 @@ void LastCallers(char *OpData)
Enter(1); Enter(1);
LineCount++; LineCount++;
if (LineCount == exitinfo.iScreenLen) { if (LineCount == rows) {
Pause(); Pause();
LineCount = 0; LineCount = 0;
} }
@ -139,7 +141,7 @@ void LastCallers(char *OpData)
} }
colour(GREEN, BLACK); colour(GREEN, BLACK);
fLine(79); fLine(cols -1);
fclose(pLC); fclose(pLC);
Enter(1); Enter(1);

View File

@ -74,6 +74,7 @@ char *Message[TEXTBUFSIZE +1];/* Message compose text buffer */
FILE *qf; /* Quote file */ FILE *qf; /* Quote file */
extern int do_mailout; extern int do_mailout;
extern int LC_Wrote; /* Lastcaller info write message */ extern int LC_Wrote; /* Lastcaller info write message */
extern int rows;
/* /*
@ -103,7 +104,7 @@ int LC(int Lines)
iLineCount += Lines; iLineCount += Lines;
if (iLineCount >= exitinfo.iScreenLen && iLineCount < 1000) { if (iLineCount >= rows && iLineCount < 1000) {
iLineCount = 1; iLineCount = 1;
pout(CFG.MoreF, CFG.MoreB, (char *) Language(61)); pout(CFG.MoreF, CFG.MoreB, (char *) Language(61));
@ -1955,7 +1956,7 @@ int CheckLine(int FG, int BG, int Email, int Conv)
x = strlen(Language(61)); x = strlen(Language(61));
iLineCount++; iLineCount++;
if ((iLineCount >= (exitinfo.iScreenLen -1)) && (iLineCount < 1000)) { if ((iLineCount >= (rows -1)) && (iLineCount < 1000)) {
iLineCount = 7; iLineCount = 7;
DoNop(); DoNop();
@ -2208,7 +2209,7 @@ void MsgArea_List(char *Option)
Recno++; Recno++;
if ((iAreaCount / 2) == exitinfo.iScreenLen) { if ((iAreaCount / 2) == rows) {
/* More (Y/n/=/Area #): */ /* More (Y/n/=/Area #): */
pout(CFG.MoreF, CFG.MoreB, (char *) Language(207)); pout(CFG.MoreF, CFG.MoreB, (char *) Language(207));
/* /*

View File

@ -44,9 +44,11 @@
#include "openport.h" #include "openport.h"
extern int do_quiet; /* Logging quiet flag */ extern int do_quiet; /* Logging quiet flag */
time_t t_start; time_t t_start;
char *StartTime; char *StartTime;
int cols = 80; /* Screen columns */
int rows = 80; /* Screen rows */
int main(int argc, char **argv) int main(int argc, char **argv)
@ -108,6 +110,8 @@ int main(int argc, char **argv)
if (ioctl(1, TIOCGWINSZ, &ws) != -1 && (ws.ws_col > 0) && (ws.ws_row > 0)) { if (ioctl(1, TIOCGWINSZ, &ws) != -1 && (ws.ws_col > 0) && (ws.ws_row > 0)) {
Syslog('b', "columns=%d lines=%d", ws.ws_col, ws.ws_row); Syslog('b', "columns=%d lines=%d", ws.ws_col, ws.ws_row);
cols = ws.ws_col;
rows = ws.ws_row;
} }
if ((rc = rawport()) != 0) { if ((rc = rawport()) != 0) {
@ -167,7 +171,7 @@ int main(int argc, char **argv)
* Default set the terminal to ANSI mode. If your logo * Default set the terminal to ANSI mode. If your logo
* is in color, the user will see color no mather what. * is in color, the user will see color no mather what.
*/ */
TermInit(1, 80, 24); TermInit(1, cols, rows);
/* /*
* Now it's time to check if the bbs is open. If not, we * Now it's time to check if the bbs is open. If not, we
@ -223,7 +227,7 @@ int main(int argc, char **argv)
alarm_on(); alarm_on();
Pause(); Pause();
newuser(ws.ws_row); newuser();
Fast_Bye(MBERR_OK); Fast_Bye(MBERR_OK);
return 0; return 0;
} }

View File

@ -48,9 +48,10 @@
extern int do_quiet; /* Logging quiet flag */ extern int do_quiet; /* Logging quiet flag */
time_t t_start; time_t t_start;
int cols = 80; /* Screen columns */
int rows = 24; /* Screen rows */
int main(int argc, char **argv) int main(int argc, char **argv)
@ -101,8 +102,10 @@ int main(int argc, char **argv)
Syslog(' ', " "); Syslog(' ', " ");
Syslog(' ', "MBSEBBS v%s", VERSION); Syslog(' ', "MBSEBBS v%s", VERSION);
if(ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0 && ws.ws_row>0){ if (ioctl(1, TIOCGWINSZ, &ws) != -1 && (ws.ws_col > 0) && (ws.ws_row > 0)) {
Syslog('b', "columns=%d lines=%d", ws.ws_col, ws.ws_row); Syslog('b', "columns=%d lines=%d", ws.ws_col, ws.ws_row);
cols = ws.ws_col;
rows = ws.ws_row;
} }
if ((rc = rawport()) != 0) { if ((rc = rawport()) != 0) {
@ -166,7 +169,7 @@ int main(int argc, char **argv)
* Default set the terminal to ANSI mode. If your logo * Default set the terminal to ANSI mode. If your logo
* is in color, the user will see color no mather what. * is in color, the user will see color no mather what.
*/ */
TermInit(1, 80, 24); TermInit(1, ws.ws_col, ws.ws_row);
/* /*
* Now it's time to check if the bbs is open. If not, we * Now it's time to check if the bbs is open. If not, we

View File

@ -40,13 +40,16 @@
#include "ttyio.h" #include "ttyio.h"
extern int rows;
int MoreFile(char *filename) int MoreFile(char *filename)
{ {
char Buf[81]; char Buf[81];
static FILE *fptr; static FILE *fptr;
int lines, input, ignore = FALSE, maxlines; int lines, input, ignore = FALSE, maxlines;
maxlines = lines = exitinfo.iScreenLen - 2; maxlines = lines = rows - 2;
if ((fptr = fopen(filename,"r")) == NULL) { if ((fptr = fopen(filename,"r")) == NULL) {
snprintf(Buf, 81, "%s%s", (char *) Language(72), filename); snprintf(Buf, 81, "%s%s", (char *) Language(72), filename);

View File

@ -65,13 +65,15 @@ extern char *ieHandle; /* Users Handle */
extern time_t t_start; /* Program starttime */ extern time_t t_start; /* Program starttime */
int do_mailout = FALSE; /* Just for linking */ int do_mailout = FALSE; /* Just for linking */
int chat_with_sysop = FALSE; /* Just for linking */ int chat_with_sysop = FALSE; /* Just for linking */
extern int rows;
extern int cols;
/* /*
* The main newuser registration function * The main newuser registration function
*/ */
int newuser(int rows) int newuser(void)
{ {
FILE *pUsrConfig; FILE *pUsrConfig;
int i, x, Found, iLang, recno = 0, Count = 0, badname; int i, x, Found, iLang, recno = 0, Count = 0, badname;
@ -464,7 +466,8 @@ int newuser(int rows)
} else { } else {
usrconfig.iScreenLen = 24; usrconfig.iScreenLen = 24;
} }
TermInit(usrconfig.GraphMode, 80, usrconfig.iScreenLen); rows = usrconfig.iScreenLen;
TermInit(usrconfig.GraphMode, cols, rows);
alarm_on(); alarm_on();
usrconfig.tLastPwdChange = ltime; /* Days Since Last Password Change */ usrconfig.tLastPwdChange = ltime; /* Days Since Last Password Change */

View File

@ -4,7 +4,7 @@
#define _NEWUSER_H #define _NEWUSER_H
int newuser(int); int newuser(void);
void Fast_Bye(int); void Fast_Bye(int);
#endif #endif

View File

@ -60,6 +60,8 @@ unsigned short BarWidth;
lastread LR; lastread LR;
static char TempStr[128]; static char TempStr[128];
extern int do_mailout; extern int do_mailout;
extern int cols;
extern int rows;
char *newtear = NULL; char *newtear = NULL;
@ -250,7 +252,7 @@ void OLR_TagArea()
GetstrC(buf, 20); GetstrC(buf, 20);
if (buf[0] == '?') { if (buf[0] == '?') {
maxlines = lines = exitinfo.iScreenLen - 1; maxlines = lines = rows - 1;
/* Conference Area Msgs Description */ /* Conference Area Msgs Description */
poutCR(LIGHTCYAN, BLACK, (char *)Language(229)); poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
if ((ma = fopen(Msgname, "r")) != NULL) { if ((ma = fopen(Msgname, "r")) != NULL) {
@ -390,7 +392,7 @@ void OLR_UntagArea()
GetstrC(buf, 20); GetstrC(buf, 20);
if (buf[0] == '?') { if (buf[0] == '?') {
maxlines = lines = exitinfo.iScreenLen - 1; maxlines = lines = rows - 1;
/* Conference Area Msgs Description */ /* Conference Area Msgs Description */
poutCR(LIGHTCYAN, BLACK, (char *)Language(229)); poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
if ((ma = fopen(Msgname, "r")) != NULL) { if ((ma = fopen(Msgname, "r")) != NULL) {
@ -747,7 +749,7 @@ void OLR_ViewTags()
/* Conference Area Msgs Description */ /* Conference Area Msgs Description */
poutCR(LIGHTCYAN, BLACK, (char *)Language(229)); poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
colour(CYAN, BLACK); colour(CYAN, BLACK);
maxlines = lines = exitinfo.iScreenLen - 1; maxlines = lines = rows - 1;
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) { while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
fseek(ma, msgshdr.syssize, SEEK_CUR); fseek(ma, msgshdr.syssize, SEEK_CUR);

View File

@ -55,6 +55,8 @@
extern int sock; extern int sock;
extern int cols;
extern int rows;
extern pid_t mypid; extern pid_t mypid;
char *StartTime = NULL; char *StartTime = NULL;
@ -168,7 +170,7 @@ void SwapDate(char *Date3, char *Date4)
void user() void user(void)
{ {
FILE *pUsrConfig, *pLimits; FILE *pUsrConfig, *pLimits;
int i, x, FoundName = FALSE, iFoundLimit = FALSE, IsNew = FALSE, logins = 0, Start; int i, x, FoundName = FALSE, iFoundLimit = FALSE, IsNew = FALSE, logins = 0, Start;
@ -257,7 +259,7 @@ void user()
UserCity(mypid, usrconfig.Name, usrconfig.sLocation); UserCity(mypid, usrconfig.Name, usrconfig.sLocation);
else else
UserCity(mypid, usrconfig.Name, (char *)"N/A"); UserCity(mypid, usrconfig.Name, (char *)"N/A");
TermInit(usrconfig.GraphMode, 80, usrconfig.iScreenLen); TermInit(usrconfig.GraphMode, cols, rows);
/* /*
* Count simultaneous logins * Count simultaneous logins

View File

@ -40,6 +40,9 @@
#include "ttyio.h" #include "ttyio.h"
extern int rows;
void UserList(char *OpData) void UserList(char *OpData)
{ {
FILE *pUsrConfig; FILE *pUsrConfig;
@ -133,7 +136,7 @@ void UserList(char *OpData)
Enter(1); Enter(1);
} }
if (LineCount >= exitinfo.iScreenLen - 2) { if (LineCount >= rows - 2) {
LineCount = 0; LineCount = 0;
Pause(); Pause();
colour(CYAN, BLACK); colour(CYAN, BLACK);