/* * ChPhrase() * * This is necessary to search the files found for a phrase either in their * file comments or in the data part of a 'strange' file (GIF, etc). */ void *ChPhrase(DirEntry *e, DirEntry *d) { FILE *fd; int format; char buf[100]; extern FunnyInfo Formats[]; if (!FindFileComment(e->unambig, FALSE) || matchString(msgBuf.mbtext, Phrase, lbyte(msgBuf.mbtext)) == NULL) { /* * This code extracts information from the GIF, etc file and * matches it against the given phrase. */ format = CompressType(e->unambig); if (format == ERROR || Formats[format].Many) return d; if ((fd = fopen(e->unambig, READ_ANY)) == NULL) return d; (*Formats[format].Func)(fd, FALSE, buf); fclose(fd); if (matchString(buf, Phrase, lbyte(buf)) == NULL) return d; } return NULL; }
/* * ActiveEvents() * * This puts together something vaguely resembling a useful list of currently * active events. */ void ActiveEvents(char *buf) { int i; void ShowRed(); sprintf(lbyte(buf), "\n Active Events:\n "); if (Dl_Limit_On()) sprintf(lbyte(buf), "D-L time limit of %ld minutes.\n ", Dl_Limit); if (Door_Limit_On()) sprintf(lbyte(buf), "Door time limit of %ld minutes.\n ", Door_Limit); if (GetFirst(&Redirected) != NULL) sprintf(lbyte(buf), "%d Redirect Files active.\n ", RunList(&Redirected, NoFree)); if (GetFirst(&AutoDoors) != NULL) sprintf(lbyte(buf), "%d Auto Doors active.\n ", RunList(&AutoDoors, NoFree)); if (NewUserAllowed()) sprintf(lbyte(buf), "New Users Allowed event active.\n "); if (NewUserDisAllowed()) sprintf(lbyte(buf), "New Users Disallowed event active.\n "); if (ClassActive[CL_ANYTIME_NET]) { sprintf(lbyte(buf), "Anytime net (deadtime=%d) active for net(s) ", DeadTime); for (i = 0; i < 32; i++) if ((1l << i) & AnyTimeNets) sprintf(lbyte(buf), "%d, ", i + 1); buf[strLen(buf) - 2] = 0; strcat(buf, ".\n "); } }
void EventShow() { void ExamineEvent(), ShowTW(); int i; mPrintf("\nCurAbs=%ld\n ", CurAbsolute()); mPrintf("ANYTIME NET is %d\n ", ClassActive[CL_ANYTIME_NET]); mPrintf("non-preempt nextabs is %ld, %ld seconds away\n ", Types[2].NextAbs, Types[2].NextAbs - CurAbsolute()); mPrintf("Preemptive list (%ld):\n ", Types[0].NextAbs); RunList(&Types[0].List, ExamineEvent); modIn(); mPrintf("Non-Preemptive list (%ld):\n ", Types[1].NextAbs); RunList(&Types[1].List, ExamineEvent); modIn(); mPrintf("Quiet list (%ld):\n ", Types[2].NextAbs); RunList(&Types[2].List, ExamineEvent); modIn(); mPrintf("Event ending list:\n "); RunList(&EventEnds, ShowTW); mPrintf("Anytime net is %s\n ", (ClassActive[CL_ANYTIME_NET]) ? "On" : "Off"); if (ClassActive[CL_ANYTIME_NET]) { msgBuf.mbtext[0] = 0; for (i = 0; i < 32; i++) if ((1l << i) & AnyTimeNets) sprintf(lbyte(msgBuf.mbtext), "%d, ", i + 1); if (strlen(msgBuf.mbtext)) msgBuf.mbtext[strLen(msgBuf.mbtext) - 2] = 0; mPrintf("Anytime nets: %s\n ", msgBuf.mbtext); } }
void ShowFaxResult(NumToString *data) { if (data->num == R_FAX) { sprintf(lbyte(msgBuf.mbtext), "\"%s\"\n ", data->string); } }
/* * logMessage() * * This function puts messages in the CALLLOG.SYS file depending on a number * of different events and conditions. */ void logMessage(int typemessage, UNS_32 val, int flags) { static int oldDay = 0; FILE *fd; int yr, dy, hr, mn, rover; char *mon, buf[100]; char *format = "%s %s @ %d:%02d%s"; char *SaveName = "callsave.sys"; if (CallCrash) return; if (typemessage == BAUD || typemessage == DOOR_RETURN) { BaudRate = val; } if (cfg.Audit == 0) return; makeAuditName(CallFn, "calllog.sys"); getCdate(&yr, &mon, &dy, &hr, &mn); switch (typemessage) { case SET_FLAG: lgin.flags |= flags; break; case FIRST_IN: oldDay = dy; sprintf(buf, format, "System brought up", formDate(), hr, mn, ""); CallMsg(CallFn, buf); break; #ifndef NO_DOORS case DOOR_RETURN: oldDay = dy; if ((fd = fopen(SaveName, READ_ANY)) != NULL) { fread(&lgin, sizeof lgin, 1, fd); fclose(fd); unlink(SaveName); } else printf("No luck with %s.", SaveName); break; #endif case CRASH_OUT: case LAST_OUT: sprintf(buf, format, "System brought down", formDate(), hr, mn, (typemessage == CRASH_OUT) ? " (crash exit!)" : ""); CallMsg(CallFn, buf); return; #ifndef NO_DOORS case DOOR_OUT: if ((fd = fopen(SaveName, WRITE_ANY)) != NULL) { fwrite(&lgin, sizeof lgin, 1, fd); fclose(fd); } else printf("No luck with %s.", SaveName); break; #endif case BAUD: lgin.person[0] = 0; lgin.flags = 0; goto datestuff; /* ACK! ACK! ACK! */ case L_IN: strCpy(lgin.person, logBuf.lbname); lgin.flags = flags; case INTO_NET: datestuff: lgin.year = yr; lgin.day = dy; lgin.hour = hr; lgin.minute = mn; strcpy(lgin.month, mon); break; case CARRLOSS: homeSpace(); /* back to our regular lair, don't break! */ case L_OUT: lgin.flags |= flags; /* * BaudRate > 0 means the user is on the system console. * So this code means "If no person is logged in and * Anonymous session logging is off OR the anonymous user * was at the system console ..." */ if (!lgin.person[0] && !(cfg.BoolFlags.AnonSessions && BaudRate > 0)) { break; } if (lgin.lastuserday != dy && lgin.lastuserday != 0) CallMsg(CallFn, ""); lgin.lastuserday = dy; sprintf(buf, "%-22s: %2d%s%02d %2d:%02d - %2d:%02d ", (strLen(lgin.person)) ? lgin.person : "<No Login>", lgin.year, lgin.month, lgin.day, lgin.hour, lgin.minute, hr, mn); switch (BaudRate) { case (UNS_32) 0: strcat(buf, "(sysConsole)"); break; case (UNS_32) -1: strcat(buf, "(Unknown)"); break; default: sprintf(lbyte(buf), "(%ld)", BaudRate); } for (rover = 0; rover < NumElems(Flags); rover++) { if (lgin.flags & Flags[rover].flag) sprintf(lbyte(buf), " %c", Flags[rover].val); } CallMsg(CallFn, buf); lgin.person[0] = 0; oldDay = dy; if (typemessage == CARRLOSS) BaudRate = 0l; goto datestuff; case OUTOF_NET: if (cfg.Audit == 1) { sprintf(buf, "System in network mode: %d%s%02d %2d:%02d - %2d:%02d", lgin.year, lgin.month, lgin.day, lgin.hour, lgin.minute, hr, mn); CallMsg(CallFn, buf); } break; default: printf("crashout: unknown case in switch statement"); } }
/* * fileMessage() * * This function handles the upload/download file log. */ void fileMessage(char mode, char *fn, char IsDL, int protocol, long size) { long hours, mins; static label LastActive = ""; char logfn[100]; /* int yr, dy, hr, mn; */ char *mon, *pr, buf[100]; static struct timeData gData, fData, xData; struct timeData *pData; static long xwork; static char fin_done; if (protocol == ASCII || cfg.Audit == 0) return; makeAuditName(logfn, "filelog.sys"); /* getCdate(&yr, &mon, &dy, &hr, &mn); */ getCdate(&gData.year, &mon, &gData.day, &gData.hour, &gData.minute); strcpy(gData.month, mon); switch (mode) { case FL_START: startTimer(USER_TIMER); fin_done = FALSE; fData = gData; break; case FL_FIN: fin_done = TRUE; xData = gData; xwork = chkTimeSince(USER_TIMER); break; case FL_SUCCESS: case FL_FAIL: case FL_EX_END: if (strCmpU(LastActive, logBuf.lbname) != SAMESTRING) { sprintf(buf, "\n%s on %d%s%02d @ ", logBuf.lbname, gData.year, mon, gData.day); if (BaudRate > 0l) sprintf(lbyte(buf), "%ld", BaudRate); else strcat(buf, "Unknown"); strcat(buf, ":"); CallMsg(logfn, buf); strCpy(LastActive, logBuf.lbname); } if (!fin_done) { xwork = chkTimeSince(USER_TIMER); pData = &gData; } else pData = &xData; hours = xwork / 3600; xwork -= (hours * 3600); mins = xwork / 60; xwork -= (mins * 60); if (protocol > TOP_PROTOCOL) pr = FindProtoName(protocol); else pr = Table[protocol].GenericName; if (mode == FL_EX_END) { sprintf(buf, "%2cFollowing files %c %s via %s %d:%02d - %d:%02d (%ld:%02ld:%02ld):", ' ', (IsDL) ? 'D' : 'U', roomBuf.rbname, pr, fData.hour, fData.minute, pData->hour, pData->minute, hours, mins, xwork); CallMsg(logfn, buf); CallMsg(logfn, msgBuf.mbtext); } else { if (!IsDL && mode == FL_FAIL) sprintf(buf, "%2c%s (FAILED) %c %s: %d:%02d - %d:%02d (%ld:%02ld:%02ld) %s.", ' ', fn, (IsDL) ? 'D' : 'U', roomBuf.rbname, fData.hour, fData.minute, pData->hour, pData->minute, hours, mins, xwork, pr); else sprintf(buf, "%2c%s (%ld) %c %s: %d:%02d - %d:%02d (%ld:%02ld:%02ld) %s. %s", ' ', fn, size, (IsDL) ? 'D' : 'U', roomBuf.rbname, fData.hour, fData.minute, pData->hour, pData->minute, hours, mins, xwork, pr, (mode == FL_FAIL) ? "(FAILED)" : ""); CallMsg(logfn, buf); } break; } }