Automatic setting screenlength for new users
This commit is contained in:
parent
20864b64b4
commit
757de0c8fa
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define _NEWUSER_H
|
||||
|
||||
|
||||
int newuser(void);
|
||||
int newuser(int);
|
||||
void Fast_Bye(int);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user