diff --git a/ChangeLog b/ChangeLog index d9a7a602..60c83ec7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,8 @@ v0.71.5 18-Aug-2005 mbnewusr: Changed syntax for calling mbpasswd. + If we can detect the users screenlength then we don't bother + asking the user. mbsetup: Added node setup switch to override node Hold or Down status. diff --git a/mbsebbs/mbnewusr.c b/mbsebbs/mbnewusr.c index f249535e..6b464a3e 100644 --- a/mbsebbs/mbnewusr.c +++ b/mbsebbs/mbnewusr.c @@ -55,6 +55,7 @@ int main(int argc, char **argv) FILE *pTty; int i, rc = 0; struct passwd *pw; + struct winsize ws; pTTY = calloc(15, sizeof(char)); tty = ttyname(1); @@ -105,6 +106,10 @@ int main(int argc, char **argv) Syslog(' ', " "); Syslog(' ', "MBNEWUSR v%s", VERSION); + 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); + } + if ((rc = rawport()) != 0) { WriteError("Unable to set raw mode"); Fast_Bye(MBERR_OK);; @@ -218,7 +223,7 @@ int main(int argc, char **argv) alarm_on(); Pause(); - newuser(); + newuser(ws.ws_row); Fast_Bye(MBERR_OK); return 0; } diff --git a/mbsebbs/newuser.c b/mbsebbs/newuser.c index e9bea5b8..f27d546f 100644 --- a/mbsebbs/newuser.c +++ b/mbsebbs/newuser.c @@ -71,7 +71,7 @@ int chat_with_sysop = FALSE; /* Just for linking */ /* * The main newuser registration function */ -int newuser() +int newuser(int rows) { FILE *pUsrConfig; int i, x, Found, iLang, recno = 0, Count = 0, badname; @@ -450,7 +450,10 @@ int newuser() usrconfig.iTimeLeft = 20; /* Set Timeleft in users file to 20 */ - if (CFG.AskScreenlen) { + if ((rows > 18) && (rows < 100)) { + usrconfig.iScreenLen = rows; + Syslog('+', "Setting screenlength to %d according to the users termianl", rows); + } else if (CFG.AskScreenlen) { Enter(1); /* Please enter your Screen Length [24]: */ pout(LIGHTMAGENTA, BLACK, (char *) Language(64)); diff --git a/mbsebbs/newuser.h b/mbsebbs/newuser.h index 9dc832e8..1ce4f6b3 100644 --- a/mbsebbs/newuser.h +++ b/mbsebbs/newuser.h @@ -4,7 +4,7 @@ #define _NEWUSER_H -int newuser(void); +int newuser(int); void Fast_Bye(int); #endif