/* * RemoveUser() * * This function handles removing a user from the log. */ void RemoveUser(int logNo, logBuffer *lBuf) { extern SListBase Moderators; extern SListBase MailForward; SYS_FILE killHeld; void *RemoveModerator(); char heldbuf[20]; /* remove old held message */ if (cfg.BoolFlags.HoldOnLost) { sprintf(heldbuf, LCHeld, logNo); makeSysName(killHeld, heldbuf, &cfg.holdArea); unlink(killHeld); } /* remove mail forwarding */ KillData(&MailForward, lBuf->lbname); UpdateForwarding(); /* remove moderator listing */ AltKillData(&Moderators, RemoveModerator, lBuf->lbname); WriteAList(&Moderators, "ctdlmodr.sys", WrtNtoStr); /* remove bio */ ClearBio(logNo); /* clear ignore mail stuff */ IgMailRemoveEntries(logNo, -1); IgMailRemoveEntries(-1, logNo); }
void CBaseObject::KillDontFree(void) { LOG_OBJECT_DESTRUCTION(this); KillData(); KillInternalData(); miFlags |= OBJECT_FLAGS_KILLED; }
void ChangeBook(ISBN * BookArray, int BookNum, char* *SearchMsg, char* *ChangeMsg){ char SearchBookdata[128] = { ' ' }; int SearchBookIndex = 0; printf("수정하고 싶은 도서 명 :"); gets(SearchBookdata); fflush(stdin); int ReturnSearch = SSearch(BookArray, BookNum, SearchBookdata, &SearchBookIndex); printf("%s", SearchMsg[ReturnSearch]); if (ReturnSearch == 0){ printf("수정할 정보 :"); KillData(&BookArray[SearchBookIndex]); InputBookData(&BookArray[SearchBookIndex]); } printf("%s", ChangeMsg[ReturnSearch]); }
void main(){ char * SearchMsg[] = { "찾기성공", "삭제 등록된 데이터가 없습니다.", "찾으려는 데이터가 존재하지 않습니다." }; char * ChangeMsg[] = { "수정성공", "등록된 데이터가 없습니다.", "찾으려는 데이터가 존재하지 않습니다." }; char * DeleteMsg[] = { "삭제성공", "삭제 등록된 데이터가 없습니다.", "찾으려는 데이터가 존재하지 않습니다." }; ISBN * BookArray = {}; char mode = '1'; int TotalBook=10; int BookNum = 0; BookArray = (ISBN *)malloc(sizeof(ISBN)* 1); while (mode != '0'){ printf("\nmode 선택 ( 1 = 입력 , 2 = 출력 , 3 = 단일검색, 4 = 수정(정확한 이름), 5 = 단일삭제(정확한 이름), 6 = 파일저장, 7 = 파일로드 0 = 종료) \n"); mode = getchar(); fflush(stdin); switch (mode) { case '1': AddBook(BookArray, &BookNum, TotalBook); break; case '2': PrintBookList(BookArray, BookNum); break; case '3': SearchBook(BookArray, BookNum, SearchMsg); break; case '4': ChangeBook(BookArray, BookNum, SearchMsg, ChangeMsg); break; case '5': DeleteBook(BookArray, &BookNum, DeleteMsg); break; case '6': FilePrint(BookArray, TotalBook, BookNum); break; case '7': FileScan(BookArray, &TotalBook, &BookNum); break; default: mode = '0'; for (int i= 0; i < TotalBook;i++) KillData(&BookArray[i]); break; } } }
void DeleteBook(ISBN * BookArray, int *BookNum, char* *DeleteMsg){ char SearchBookdata[128] = { ' ' }; int SearchBookIndex = 0; printf("수정하고 싶은 도서 명 :"); gets(SearchBookdata); fflush(stdin); int ReturnSearch = SSearch(BookArray, *BookNum, SearchBookdata, &SearchBookIndex); if (ReturnSearch == 0){ for (int i = SearchBookIndex; i < *BookNum; i++){ KillData(&BookArray[i]); BookArray[i].Title = BookArray[i + 1].Title; for (int j = 0; j < BookArray[i].WriterNum; j++){ BookArray[i].Writer[j] = BookArray[i + 1].Writer[j]; } BookArray[i].Company = BookArray[i + 1].Company; BookArray[i].Price = BookArray[i + 1].Price; for (int j = 0; j < BookArray[i].TableNum; j++){ BookArray[i].Table[j] = BookArray[i + 1].Table[j]; } } *BookNum -= 1; } printf("%s", DeleteMsg[ReturnSearch]); }
/* * 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; }
/* * 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; }
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(); } }