Exemple #1
0
/*
 * NewSharedRoom()
 *
 * This function finds a slot for a new shared room.
 */
SharedRoomData *NewSharedRoom()
{
    SharedRoomData *Found = NULL;
    void FindUnused();

    RunListA(&SharedRooms, FindUnused, &Found);
    if (Found == NULL) {
	Found = GetDynamic(sizeof *Found);
	Found->room = GetDynamic(sizeof *Found->room);
	Found->slot = SR_Count++;
	AddData(&SharedRooms, Found, NULL, FALSE);
    }
    Found->srd_flags = SRD_DIRTY;
    return Found;
}
Exemple #2
0
/*
 * InitBuffers()
 *
 * This function initializes the message buffers.
 */
void InitBuffers()
{
    static SListBase MsgBase = { NULL, ChkCC, NULL, free, strdup };

    copy_struct(MsgBase, msgBuf.mbCC);
    copy_struct(MsgBase, msgBuf.mbOverride);
    copy_struct(MsgBase, msgBuf.mbInternal);
    copy_struct(MsgBase, msgBuf.mbForeign);

    copy_struct(MsgBase, tempMess.mbOverride);
    copy_struct(MsgBase, tempMess.mbCC);
    copy_struct(MsgBase, tempMess.mbInternal);
    copy_struct(MsgBase, tempMess.mbForeign);

    msgBuf.mbtext   = GetDynamic(MAXTEXT);
    tempMess.mbtext = GetDynamic(MAXTEXT);
}
Exemple #3
0
/*
 * MakeTwo()
 *
 * This creates a new record for addition to a list.
 */
TwoNumbers *MakeTwo(int First, long Second)
{
    TwoNumbers *tmp;

    tmp = (TwoNumbers *) GetDynamic(sizeof *tmp);
    tmp->first  = First;
    tmp->second = Second;
    return tmp;
}
Exemple #4
0
/*
 * EatTwoNumbers()
 *
 * This function will eat a line of text from disk and make it into a record
 * for placement on a disk.  It's simply a space separated string.
 */
void *EatTwoNumbers(char *line)
{
    TwoNumbers *temp;
    char *space;

    if ((space = strchr(line, ' ')) == NULL)
	return NULL;
    temp = GetDynamic(sizeof *temp);
    temp->first = atoi(line);
    temp->second = atol(space + 1);
    return temp;
}
Exemple #5
0
/*
 * initSharedRooms()
 *
 * This function initializes the shared rooms of the system.  It reads the
 * shared room information from shared.sys and places it in the internal list
 * SharedRooms, where each record is not a SharedRoom, but a SharedRoomData.
 * This data type includes a slot number and a flags field including a dirty
 * bit-flag, which indicates if the given record needs to be written.
 *
 * This list is periodically written out as needed, so we are basically
 * mirroring the the disk list with a RAM list.
 */
void initSharedRooms(char check)
{
    SharedRoom *room;
    SharedRoomData *roomd;
    SYS_FILE shared;

    makeSysName(shared, "shared.sys", &cfg.netArea);
    if ((sharedfd = fopen(shared, READ_ANY)) != NULL) {
	room = GetDynamic(sizeof *room);
	while (fread(room, sizeof *room, 1, sharedfd) > 0) {
	    roomd = GetDynamic(sizeof *roomd);
	    roomd->slot = SR_Count++;
	    roomd->srd_flags = 0;
	    roomd->room = room;
	    AddData(&SharedRooms, roomd, NULL, TRUE);
	    room = GetDynamic(sizeof *room);
	}
	free(room);
	fclose(sharedfd);
    }
}
Exemple #6
0
/*
 * RedirectFile()
 *
 * This function is used to discover if the given file should be redirected from
 * the normal file reception area to somewhere else.
 *
 * If it should be then a pointer is returned to a string representing the new
 * location; otherwise, NULL is returned.
 */
char *RedirectFile(char *filename, char *systemname)
{
    EvDoorRec rec;

    rec.Evt = GetDynamic(sizeof (EVENT));	/* get around possible bug */

	/* prepare for search */
    strcpy(rec.Evt->vars.Redirect.EvFilename, filename);
    strcpy(rec.Evt->vars.Redirect.EvSystem, systemname);

    Cur = SearchList(&Redirected, &rec);
    free(rec.Evt);

    return (Cur != NULL) ? cfg.codeBuf + Cur->vars.Redirect.EvHomeDir : NULL;
}
Exemple #7
0
/*
 * CheckAutoDoor()
 *
 * This function checks to see if the given login name has an autodoor that
 * should be executed.  It returns -1 if no such autodoor exists, otherwise
 * it returns the EvExitVal value associated with the autodoor entry.  This
 * function resides in here rather than the door source because autodoors
 * are implemented as #events.
 */
int CheckAutoDoor(char *name)
{
    EvDoorRec rec;

    rec.Evt = GetDynamic(sizeof (EVENT));	/* get around possible bug */
    strcpy(rec.Evt->vars.EvUserName, name);

    if ((Cur = SearchList(&AutoDoors, &rec)) != NULL) {
	free(rec.Evt);
	return (int) Cur->EvExitVal;
    }

    free(rec.Evt);
    return ERROR;
}
Exemple #8
0
/*
 * ValidArea()
 *
 * This will validate an area choice the system operator has made.
 */
char ValidArea(char *area)
{
    char drive, *work, c;

    MSDOSparse(area, &drive);
    c = fileType(area, drive);

    if (!CheckArea(NO_MENU, c, &drive, area))
	return FALSE;

    work = GetDynamic(strlen(area) + 5);
    sprintf(work, "%c:%s", drive, area);
    strcpy(area, work);
    free(work);
    return TRUE;
}
Exemple #9
0
/*
 * EatEditorLine()
 *
 * This will eat a line from editors.sys and return a variable of type
 * Editor for use in list stuff.
 *
 * format is "<selector letter> <s.name> <command line>"
 */
static void *EatEditorLine(char *line)
{
    Editor *work;
    char   *c;

    if ((c = strchr(line, ' ')) == NULL) return NULL;
    if (line[0] == '"') {
	line++;
	if ((c = strchr(line, '"')) == NULL) return NULL;
	*c = 0;
	c++;
    }
    *c = 0;
    work = GetDynamic(sizeof *work);
    work->Name = strdup(line);
    work->CmdLine = strdup(c + 1);
    return work;
}
Exemple #10
0
/*
 * FigureEvent()
 *
 * This function handles an event becoming active and takes action.
 */
int FigureEvent(int index)
{
    long ThisAbs, temp, InSeconds, EndIt = -1l, CalcEnd;
    EvDoorRec *EvDoor;

    temp = (long) Cur->EvMinutes;
    InSeconds = temp * 60l;
    ThisAbs = ThisAbsolute - WeekDiff(ThisSecond, InSeconds);
    CalcEnd = ThisAbs + (Cur->EvDur * 60l);

    switch (Cur->EvClass) {
    case CL_UNTIL_NET:
    case CLNET:
	netController(Cur->EvMinutes % 1440, Cur->EvDur,
			Cur->EvExitVal,
			(Cur->EvClass == CLNET) ? NORMAL_NET : UNTIL_NET,
			REPORT_FAILURE | LEISURELY);
	startTimer(NEXT_ANYNET);
	break;
    case CLEXTERN:
	ExitToMsdos = TRUE;
	exitValue = (int) Cur->EvExitVal;
	return TRUE;	/* force it */
    case CL_DL_TIME:
	EndIt = CalcEnd;
	Dl_Limit = Cur->EvExitVal;
	ResolveDLStuff();
	DlMsgPtr = cfg.codeBuf + Cur->EvWarn;
	break;
    case CL_ANYTIME_NET:
	EndIt = CalcEnd;
			/* gets eligible nets */
	AnyTimeNets = Cur->EvExitVal;
	DeadTime    = Cur->vars.Anytime.EvDeadTime;
	AnyNetLen   = Cur->vars.Anytime.EvAnyDur;
	break;
    case CL_DOOR_TIME:
	EndIt = CalcEnd;
	Door_Limit = Cur->EvExitVal;
	break;
    case CL_AUTODOOR:
    case CL_REDIRECT:
	EvDoor = GetDynamic(sizeof *EvDoor);
	EvDoor->Evt = Cur;
	EvDoor->finish = CalcEnd;
	AddData((Cur->EvClass == CL_AUTODOOR) ? &AutoDoors : &Redirected,
						EvDoor, NULL, TRUE);
	break;
    case CL_CHAT_ON:
    case CL_CHAT_OFF:
	cfg.BoolFlags.noChat = (Cur->EvClass != CL_CHAT_ON);
	ScrNewUser();
	EndIt = CalcEnd;
	break;
    case CL_NEWUSERS_ALLOWED:
    case CL_NEWUSERS_DISALLOWED:
	cfg.BoolFlags.unlogLoginOk = (Cur->EvClass == CL_NEWUSERS_ALLOWED);
	EndIt = CalcEnd;
	break;
    case CL_NETCACHE:
	CacheMessages(Cur->EvExitVal, FALSE);
	break;
    default:	/* do nothing */
	;       /* required by ANSI */
    }

    if (EndIt != -1l) {
	AddData(&EventEnds, MakeTwo(Cur->EvClass, EndIt), NULL, TRUE);
	ClassActive[Cur->EvClass] = TRUE;       /* turn it on, baby! */
    }

    if (!(Cur->EvFlags & EV_DAY_BASE))
	FrontToEnd(&Types[index].List);	/* put event on end of list */
    else
	KillData(&Types[index].List, GetFirst(&Types[index].List));

    Types[index].LastAbs = ThisAbs;
    SetAbs(&Types[index], Types[index].LastAbs);

    return Types[index].toReturn;
}
Exemple #11
0
void CitGetFileList(char *mask, SListBase *list, long before, long after,
								char *phrase)
{
    struct ffblk   FlBlock;
    extern char    *monthTab[13];
    char	   *w, *work, *sp, again, buf[10];
    DirEntry       *fp;
    int		   done;
    struct stat    buff;
    long	   time;

    w = work = strdup(mask);

    do {
	again = (sp = strchr(work, ' ')) != NULL;      /* space is separator */
	if (again) {
	    *sp = 0;
	}
	/* Do all scanning for illegal requests here */
	if (!ValidDirFileName(work))
	    continue;

	/* this checks for illegal file names like CON:, PRN:, etc. */
	if (stat(work, &buff) == 0)
	    if (buff.st_mode & S_IFCHR)
		continue;

	for (done = findfirst(work, &FlBlock, 0); !done; 
						done = findnext(&FlBlock)) {
	    /* format date to our standards */
	    DosToNormal(buf, FlBlock.ff_fdate);

	    /* now read it so we can handle date specs */
	    ReadDate(buf, &time);

	    /* add to list iff dates inactive or we meet the specs */
	    if ((before != -1l && time > before) ||
				(after  != -1l && time < after))
		continue;

	    fp = (DirEntry *) GetDynamic(sizeof *fp);

	    fp->unambig = strdup(FlBlock.ff_name);

	    strCpy(fp->FileDate, buf);
	    fp->FileSize = FlBlock.ff_fsize;

	    AddData(list, fp, NULL, TRUE);
	}
	if (again) work = sp+1;
    } while (again);
    free(w);

    if (strLen(phrase) != 0) {
	Phrase = phrase;
	StFileComSearch();      /* so's we can do phrase searches */
	list->CheckIt = ChPhrase;   /* COVER YOUR EYES I'M CHEATING! */
	KillData(list, list);
	list->CheckIt = DirCheck;   /* COVER YOUR EYES I'M CHEATING! */
	EndFileComment();
    }
}