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 AskAddress : 1; /* Ask Home Address */
unsigned iOneName : 1; /* Allow one user name */
unsigned AskScreenlen : 1; /* Ask screenlength */
unsigned xAskScreenlen : 1;
unsigned iCrashLevel; /* User level for crash mail*/
unsigned iAttachLevel; /* User level for fileattach*/

View File

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

View File

@ -203,7 +203,10 @@ void Help()
void die(int onsig)
{
signal(onsig, SIG_IGN);
if (onsig && (onsig <= NSIG)) {
signal(onsig, SIG_IGN);
}
if (!do_quiet) {
printf("\r");
mbse_colour(CYAN, BLACK);
@ -221,9 +224,6 @@ void die(int onsig)
WriteError("Terminated with error %d", onsig);
}
if (onsig == SIGSEGV)
Syslog('+', "Last msg area %s", msgs.Name);
if (are_tot || are_proc || msg_link)
Syslog('+', "Areas [%6d] Processed [%6d] Linked [%6d]", are_tot, are_proc, msg_link);
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 rsize = 5; /* Chat receive size */
extern pid_t mypid;
extern int cols;
extern int rows;
void Showline(int, int, char *);
@ -168,7 +171,7 @@ void Chat(char *username, char *channel)
WhosDoingWhat(SYSOPCHAT, NULL);
clear();
rsize = exitinfo.iScreenLen - 5;
rsize = rows - 5;
rpointer = 0;
if (SYSOP == TRUE) {
@ -205,7 +208,7 @@ void Chat(char *username, char *channel)
locate(1, 1);
colour(WHITE, BLUE);
clrtoeol();
snprintf(buf, 200, "%-*s", 79, " MBSE BBS Chat Server");
snprintf(buf, 200, "%-*s", cols -1, " MBSE BBS Chat Server");
mvprintw(1, 1, buf);
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);
clrtoeol();
snprintf(buf, 200, "%-*s", 79, " Chat, type \"/EXIT\" to exit or \"/HELP\" for help");
mvprintw(exitinfo.iScreenLen - 2, 1, buf);
snprintf(buf, 200, "%-*s", cols -1, " Chat, type \"/EXIT\" to exit or \"/HELP\" for help");
mvprintw(rows - 2, 1, buf);
colour(LIGHTGRAY, BLACK);
mvprintw(exitinfo.iScreenLen - 1, 1, ">");
mvprintw(rows - 1, 1, ">");
memset(&sbuf, 0, sizeof(sbuf));
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.
* 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)) {
alarm_on();
if (curpos) {
@ -333,9 +336,9 @@ void Chat(char *username, char *channel)
}
curpos = 0;
memset(&sbuf, 0, sizeof(sbuf));
locate(exitinfo.iScreenLen - 1, 2);
locate(rows - 1, 2);
clrtoeol();
mvprintw(exitinfo.iScreenLen - 1, 1, ">");
mvprintw(rows - 1, 1, ">");
}
}
chatting = FALSE;

View File

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

View File

@ -46,7 +46,8 @@
extern time_t t_start;
extern int e_pid;
extern char **environ;
extern int cols;
extern int rows;
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); /* Minutes */
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, "\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 */
int Strlen = 0;
int FileRecno = 0;
extern long arecno; /* File area number in xxxScan() functions */
int Strlen = 0;
int FileRecno = 0;
extern int rows;
int CheckFile(char *, int);
@ -461,7 +461,7 @@ void File_RawDir(char *OpData)
Enter(1);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
if (LineCount == rows) {
Pause();
LineCount = 0;
}
@ -1430,7 +1430,7 @@ void FileArea_List(char *Option)
Recno++;
if ((iAreaCount / 2) == exitinfo.iScreenLen) {
if ((iAreaCount / 2) == rows) {
/* More (Y/n/=/Area #): */
pout(CFG.MoreF, CFG.MoreB, (char *) Language(207));
/*

View File

@ -48,6 +48,7 @@
extern pid_t mypid;
long arecno = 1; /* Area record number */
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));
iLineCount += Lines;
if ((iLineCount >= exitinfo.iScreenLen) && (iLineCount < 1000)) {
if ((iLineCount >= rows) && (iLineCount < 1000)) {
iLineCount = 0;
while (TRUE) {

View File

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

View File

@ -45,7 +45,7 @@ extern pid_t mypid; /* Original pid */
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;");
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
strncpy(buf, socket_receive(), 80);
if (strncmp(buf, "100:2,0", 7) == 0)
return TRUE;
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 *temp;
static char temp1[PATH_MAX];
FILE *fp;
char *temp;
static char temp1[PATH_MAX];
FILE *fp;
temp = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
/*
* set umask bits to zero's then reset with mkdir
*/
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();
}
/*
* set umask bits to zero's then reset with mkdir
*/
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);
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)
{
if ((access(dir, R_OK) != 0)) {
Syslog('+', "Creating %s", dir);
if (mkdir(dir, 0770))
WriteError("$Can't create %s", dir);
}
if ((access(dir, R_OK) != 0)) {
Syslog('+', "Creating %s", dir);
if (mkdir(dir, 0770))
WriteError("$Can't create %s", dir);
}
}
@ -295,42 +295,42 @@ void CheckDir(char *dir)
*/
void FindMBSE()
{
FILE *pDataFile;
static char p[81];
char *FileName;
struct passwd *pw;
FILE *pDataFile;
static char p[81];
char *FileName;
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
* environment from the passwd file.
*/
if (getenv("MBSE_ROOT") == NULL) {
pw = getpwnam("mbse");
memset(&p, 0, sizeof(p));
snprintf(p, 81, "MBSE_ROOT=%s", pw->pw_dir);
putenv(p);
}
/*
* Check if the environment is set, if not, then we create the
* environment from the passwd file.
*/
if (getenv("MBSE_ROOT") == NULL) {
pw = getpwnam("mbse");
memset(&p, 0, sizeof(p));
snprintf(p, 81, "MBSE_ROOT=%s", pw->pw_dir);
putenv(p);
}
if (getenv("MBSE_ROOT") == NULL) {
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);
if (getenv("MBSE_ROOT") == NULL) {
printf("FATAL ERROR: Environment variable MBSE_ROOT not set\n");
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)
{
static char month[10];
static char month[10];
switch (Month) {
case 1:
strcpy(month, *(mLanguage + 398));
break;
case 2:
strcpy(month, *(mLanguage + 399));
break;
case 3:
strcpy(month, *(mLanguage + 400));
break;
case 4:
strcpy(month, *(mLanguage + 401));
break;
case 5:
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");
}
switch (Month) {
case 1: strcpy(month, *(mLanguage + 398)); break;
case 2: strcpy(month, *(mLanguage + 399)); break;
case 3: strcpy(month, *(mLanguage + 400)); break;
case 4: strcpy(month, *(mLanguage + 401)); break;
case 5: 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 */
char *GLCdateyy()
{
static char GLcdateyy[15];
char ntime[15];
static char GLcdateyy[15];
char ntime[15];
Time_Now = time(NULL);
l_date = localtime(&Time_Now);
Time_Now = time(NULL);
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);
strcat(GLcdateyy, GetMonth(l_date->tm_mon+1));
strcat(GLcdateyy,ntime);
snprintf(ntime, 15, "-%02d", l_date->tm_year+1900);
strcat(GLcdateyy, GetMonth(l_date->tm_mon+1));
strcat(GLcdateyy,ntime);
return(GLcdateyy);
return (GLcdateyy);
}

View File

@ -49,6 +49,8 @@ extern int LC_Wrote;
extern int LC_Chat;
extern int LC_Olr;
extern int LC_Door;
extern int rows;
extern int cols;
@ -81,7 +83,7 @@ void LastCallers(char *OpData)
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);
colour(LIGHTRED, BLACK);
@ -94,7 +96,7 @@ void LastCallers(char *OpData)
Enter(1);
colour(GREEN, BLACK);
fLine(79);
fLine(cols -1);
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if (!lcall.Hidden) {
@ -131,7 +133,7 @@ void LastCallers(char *OpData)
Enter(1);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
if (LineCount == rows) {
Pause();
LineCount = 0;
}
@ -139,7 +141,7 @@ void LastCallers(char *OpData)
}
colour(GREEN, BLACK);
fLine(79);
fLine(cols -1);
fclose(pLC);
Enter(1);

View File

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

View File

@ -44,9 +44,11 @@
#include "openport.h"
extern int do_quiet; /* Logging quiet flag */
extern int do_quiet; /* Logging quiet flag */
time_t t_start;
char *StartTime;
int cols = 80; /* Screen columns */
int rows = 80; /* Screen rows */
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)) {
Syslog('b', "columns=%d lines=%d", ws.ws_col, ws.ws_row);
cols = ws.ws_col;
rows = ws.ws_row;
}
if ((rc = rawport()) != 0) {
@ -167,7 +171,7 @@ int main(int argc, char **argv)
* Default set the terminal to ANSI mode. If your logo
* 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
@ -223,7 +227,7 @@ int main(int argc, char **argv)
alarm_on();
Pause();
newuser(ws.ws_row);
newuser();
Fast_Bye(MBERR_OK);
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;
int cols = 80; /* Screen columns */
int rows = 24; /* Screen rows */
int main(int argc, char **argv)
@ -101,8 +102,10 @@ int main(int argc, char **argv)
Syslog(' ', " ");
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);
cols = ws.ws_col;
rows = ws.ws_row;
}
if ((rc = rawport()) != 0) {
@ -166,7 +169,7 @@ int main(int argc, char **argv)
* Default set the terminal to ANSI mode. If your logo
* 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

View File

@ -40,13 +40,16 @@
#include "ttyio.h"
extern int rows;
int MoreFile(char *filename)
{
char Buf[81];
static FILE *fptr;
int lines, input, ignore = FALSE, maxlines;
maxlines = lines = exitinfo.iScreenLen - 2;
maxlines = lines = rows - 2;
if ((fptr = fopen(filename,"r")) == NULL) {
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 */
int do_mailout = FALSE; /* Just for linking */
int chat_with_sysop = FALSE; /* Just for linking */
extern int rows;
extern int cols;
/*
* The main newuser registration function
*/
int newuser(int rows)
int newuser(void)
{
FILE *pUsrConfig;
int i, x, Found, iLang, recno = 0, Count = 0, badname;
@ -464,7 +466,8 @@ int newuser(int rows)
} else {
usrconfig.iScreenLen = 24;
}
TermInit(usrconfig.GraphMode, 80, usrconfig.iScreenLen);
rows = usrconfig.iScreenLen;
TermInit(usrconfig.GraphMode, cols, rows);
alarm_on();
usrconfig.tLastPwdChange = ltime; /* Days Since Last Password Change */

View File

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

View File

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

View File

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

View File

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