コード例 #1
0
ファイル: shared.c プロジェクト: carriercomm/citadel-86
/*
 * KillSharedRoom()
 *
 * This function kills all shared rooms records associated with the specified
 * room.
 */
void KillSharedRoom(int room)
{
    void KillRecord();

    RunListA(&SharedRooms, KillRecord, &room);
    UpdateSharedRooms();
}
コード例 #2
0
ファイル: shared.c プロジェクト: carriercomm/citadel-86
/*
 * 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;
}
コード例 #3
0
ファイル: shared.c プロジェクト: carriercomm/citadel-86
/*
 * EachSharedRoom()
 *
 * This does something for each shared room.
 */
void EachSharedRoom(int system,
    int (*func)(SharedRoomData *room, int system, int roomslot, void *d),
    int (*virtfunc)(SharedRoomData *room, int system, int roomslot, void *d),
    void *data)
{
    void ExecFunc();
    SrFuncs Funcs; 

    if (!netTab[system].ntflags.in_use) return;

    Funcs.system = system;
    Funcs.func = func;
    Funcs.virtfunc = virtfunc;
    Funcs.data = data;
    Funcs.result = FALSE;

    RunListA(&SharedRooms, ExecFunc, &Funcs);
}
コード例 #4
0
ファイル: shared.c プロジェクト: carriercomm/citadel-86
/*
 * UpdateSharedRooms()
 *
 * This function updates the disk version of the shared rooms with dirty records
 * in the RAM list.
 */
void UpdateSharedRooms()
{
    char flag;
    SYS_FILE shared;
    void UpdateSR(), FindDirty();

    flag = FALSE;
    RunListA(&SharedRooms, FindDirty, &flag);
    if (flag) {
	makeSysName(shared, "shared.sys", &cfg.netArea);
	if ((sharedfd = fopen(shared, R_W_ANY)) == NULL) {
	    if ((sharedfd = fopen(shared, WRITE_ANY)) == NULL) {
		printf("CAN'T UPDATE SHARED ROOM FILE!\n");
		return;
	    }
	}
	RunList(&SharedRooms, UpdateSR);
	fclose(sharedfd);
    }
}
コード例 #5
0
ファイル: events.c プロジェクト: carriercomm/citadel-86
/*
 * DoTimeouts()
 *
 * This is the function responsible for actual checking of timeouts.  It
 * returns TRUE if you want modIn to break out, too.  It should only be called
 * from modIn().
 */
char DoTimeouts()
{
    int  yr, dy, hr, mn, temp, mon, secs, milli;
    static char   warned = FALSE;
#ifdef SYSTEM_CLOCK
    static int LastMinute = -1;
#endif
    static int LastDay = 0;
    extern int PriorityMail;
    TwoNumbers *tmp;
    EvDoorRec  *evtmp;
    extern SListBase UntilNetSessions;
    void Activate();
    char Oldpage;

    getRawDate(&yr, &mon, &dy, &hr, &mn, &secs, &milli);

#ifdef SYSTEM_CLOCK
    if (LastMinute != mn) {
	ScrTimeUpdate(hr, mn);
	LastMinute = mn;
    }
#endif

    if (LastDay != dy) {
	LastDay = dy;
	RunListA(&DayBased, Activate, (void *) &LastDay);
    }

    ThisMinute = (WhatDay() * 1440) + (hr * 60) + mn;
    ThisAbsolute = (long) ThisMinute;
    ThisSecond = ThisAbsolute * 60 + secs;

    ThisAbsolute = CurAbsolute();

    /* First we deal with events which are deactivating */
    if ((tmp = GetFirst(&EventEnds)) != NULL) {
	if (ThisAbsolute >= tmp->second) {      /* event is ending! */
	    ClassActive[tmp->first] = FALSE;
	    KillData(&EventEnds, tmp);		/* take it off the list */
	    if (tmp->first == CL_DL_TIME)
		ResolveDLStuff();
	}
    }

    if ((evtmp = GetFirst(&AutoDoors)) != NULL) {
	if (ThisAbsolute >= evtmp->finish) {    /* autodoor finish */
	    KillData(&AutoDoors, evtmp);
	}
    }

    if ((evtmp = GetFirst(&Redirected)) != NULL) {
	if (ThisAbsolute >= evtmp->finish) {    /* redirection finish */
	    KillData(&Redirected, evtmp);
	}
    }

    /* Next we deal with preemptive events, which are Type 0 */

    /* give a warning at T-5 */
    if ((Cur = GetFirst(&Types[0].List)) != NULL &&
	    !warned && Types[0].NextAbs - ThisAbsolute < 300l && onLine()) {
	temp = Cur->EvMinutes % 1440;
	warned = TRUE;
	outFlag = IMPERVIOUS;
	Oldpage = Pageable;
	Pageable = FALSE;

	mPrintf("\n %cWARNING: System going down at %d:%02d for %s.\n ",
	    BELL, temp/60, temp%60, Cur->EvWarn + cfg.codeBuf);
	outFlag = OUTOK;
	Pageable = Oldpage;
	return FALSE;
    }
    else if (Cur != NULL && Types[0].NextAbs < ThisAbsolute) {
	if (onLine()) {		/* first boot off user, next time do event */
	    outFlag = IMPERVIOUS;
	    PagingOff();
	    mPrintf("\n %cGoing to %s, bye!\n ", BELL,
						Cur->EvWarn + cfg.codeBuf);

	    if (onConsole) {		/* Ugly cheat */
		onConsole = FALSE;
		whichIO = MODEM;
		justLostCarrier = TRUE;
		EnableModem(FALSE);
	    }
	    else
		HangUp(FALSE);

	    outFlag = OUTOK;
	    return TRUE;
	}
	warned = FALSE;
	return FigureEvent(0);
    }

    if (!onLine() && (Cur = GetFirst(&Types[1].List)) != NULL &&
			Types[1].NextAbs < ThisAbsolute)
	return FigureEvent(1);

    if ((Cur = GetFirst(&Types[2].List)) != NULL &&
			Types[2].NextAbs < ThisAbsolute)
	return FigureEvent(2);

    /* check priority mail -- odd place for the check, but wotthehell */
    if (PriorityMail) {
	if (!onLine()) {
	    netController((hr*60) + mn, 0, PRIORITY_MAIL, ANYTIME_NET, 0);
	    PriorityMail = 0;
	}
    }

    /* handle anytime netting here - is special type of thing */
    if (chkTimeSince(NEXT_ANYNET) > DeadTime || ForceNet) {
	if (ClassActive[CL_ANYTIME_NET]) {
	    if (!onLine()) {
		netController((hr * 60) + mn, AnyNetLen,
				AnyTimeNets, ANYTIME_NET, 0);
		ScrNewUser();
	 	ForceNet = FALSE;
	    }
	}
	else ForceNet = FALSE;
	startTimer(NEXT_ANYNET);
    }

    /*
     * now see if we have any other net sessions due to be run.  These are
     * sessions scheduled by the user from the Net menu. If so, run each of
     * them by killing the list (the kill function should run each).
     */
    if (!onLine() && GetFirst(&UntilNetSessions) != NULL) {
	KillList(&UntilNetSessions);
    }

    return ExitToMsdos;
}
コード例 #6
0
ファイル: SYSDEP1.C プロジェクト: dylancarlson/citadel-86
/*
 * getModemId()
 *
 * This tries to read the baud id from modem.
 */
int getModemId()
{
	NumToString *temp = NULL;
	char c;
	extern FILE *netLog;
	TimePacket ff;
	int i;
	void FindSpeed();

	RunListA(&ReceivedResults, FindSpeed, &temp);
	KillList(&ReceivedResults);

	if (temp != NULL) {
		BaudFlags = temp->num2;
		if (R_FAX == temp->num) RunFax();
		memset(IdBuffer, 0, sizeof IdBuffer);
		return temp->num;
	}

	setTimer(&ff);

	i = strlen(IdBuffer);
	while (timeSince(&ff) < 5l) {
		if (MIReady()) {
			if ((c = Citinp()) == '\r' || c == '\n') {
				IdBuffer[i] = 0;
				temp = SearchList(&ResList, IdBuffer);
				if (temp != NULL)
					switch (temp->num) {
					case R_300:
					case R_1200:
					case R_2400:
					case R_4800:
					case R_9600:
					case R_14400:
					case R_19200:
						BaudFlags = temp->num2;
						memset(IdBuffer, 0, sizeof IdBuffer);
						return temp->num;
					case R_FAX:
						RunFax();
						IdBuffer[0] = 0;
						memset(IdBuffer, 0, sizeof IdBuffer);
						return ERROR;
					}
else printf("Search for %s failed\n", IdBuffer);
				i = 0;	/* restart buffer filling */
			}
			else {
				if (c != '\n') {
		    			IdBuffer[i++] = c;
				}
				if (c == '\n' ||i >= BA_BUF_SIZE - 4) { /* Fudge factor */
					memset(IdBuffer, 0, sizeof IdBuffer);
		    			i = 0;
				}
			}
		}
	}
	IdBuffer[i] = 0;      /* debug for now */
	splitF(netLog, "autobaud failure, modem spat -%s-\n", IdBuffer);
	memset(IdBuffer, 0, sizeof IdBuffer);
	return ERROR;
}
コード例 #7
0
ファイル: sysedit.c プロジェクト: carriercomm/citadel-86
/*
 * OtherEditOptions()
 *
 * This function will add options to the editor menu.  This is called by
 * editText().
 */
void OtherEditOptions(char **Options)
{
    void AddOurEditOpts();

    RunListA(&ExtEditors, AddOurEditOpts, (void *) Options);
}