Update for lost areanumber

This commit is contained in:
Michiel Broek 2002-11-11 12:55:14 +00:00
parent e98e35e244
commit db83218bc7

View File

@ -174,39 +174,34 @@ void SwapDate(char *Date3, char *Date4)
void user() void user()
{ {
FILE *pUsrConfig, *pLimits; FILE *pUsrConfig, *pLimits;
int i, x; int i, x, FoundName = FALSE, iFoundLimit = FALSE, IsNew = FALSE;
int FoundName = FALSE, iFoundLimit = FALSE; long l1, l2;
long l1, l2; char *token, temp[PATH_MAX], temp1[84], UserName[37];
char *token; time_t LastLogin;
char temp[PATH_MAX]; struct stat st;
char temp1[84];
time_t LastLogin;
struct stat st;
char UserName[37];
int IsNew = FALSE;
grecno = 0; grecno = 0;
Syslog('+', "Unixmode login: %s", sUnixName); Syslog('+', "Unixmode login: %s", sUnixName);
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp,"r+b")) == NULL) { if ((pUsrConfig = fopen(temp,"r+b")) == NULL) {
/* /*
* This should not happen. * This should not happen.
*/ */
WriteError("$Can't open %s", temp); WriteError("$Can't open %s", temp);
printf("Can't open userfile, run \"newuser\" first"); printf("Can't open userfile, run \"newuser\" first");
ExitClient(MBERR_OK); ExitClient(MBERR_OK);
} }
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig); fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
while (fread(&usrconfig, usrconfighdr.recsize, 1, pUsrConfig) == 1) { while (fread(&usrconfig, usrconfighdr.recsize, 1, pUsrConfig) == 1) {
if (strcmp(usrconfig.Name, sUnixName) == 0) { if (strcmp(usrconfig.Name, sUnixName) == 0) {
FoundName = TRUE; FoundName = TRUE;
break; break;
} else } else
grecno++; grecno++;
} }
if (!FoundName) { if (!FoundName) {
printf("Unknown username: %s\n", sUnixName); printf("Unknown username: %s\n", sUnixName);
@ -261,6 +256,14 @@ void user()
else else
UserCity(mypid, usrconfig.sUserName, (char *)"N/A"); UserCity(mypid, usrconfig.sUserName, (char *)"N/A");
/*
* Set last file and message area so these numbers are saved when
* the user hangs up or is logged off before het gets to the main
* menu. Later in this function the areas are set permanent.
*/
iAreaNumber = usrconfig.iLastFileArea;
iLastMsgArea = usrconfig.iLastMsgArea;
/* /*
* See if this user is the Sysop. * See if this user is the Sysop.
*/ */