bool ShowWelcome() { char *title = CreateText("<C></B/29>%s<!29!B>", GetTranslation("Welcome")); char filename[] = "config/welcome"; char *buttons[2] = { GetTranslation("OK"), GetTranslation("Cancel") }; int ret = ViewFile(filename, buttons, 2, title); return (ret==NO_FILE || ret==0); }
bool ShowLicense() { char *title = CreateText("<C></B/29>%s<!29!B>", GetTranslation("License agreement")); char filename[] = "config/license"; char *buttons[2] = { GetTranslation("Agree"), GetTranslation("Decline") }; int ret = ViewFile(filename, buttons, 2, title); return (ret==NO_FILE || ret==0); }
bool FinishInstall() { char *file = CreateText("%s/config/finish", InstallInfo.own_dir.c_str()); if (FileExists(file)) { char *title = CreateText("<C></B/29>%s<!29!B>", GetTranslation("Please read the following text")); char *buttons[1] = { GetTranslation("OK") }; ViewFile(file, buttons, 1, title); return true; } return true; }
void updateFilebrowser() { if(kDown & KEY_SELECT) { currentViewer = new SettingsViewer(); currentViewer->Init(); } //Find a better way to cycle through these if(kDown & KEY_L) { switch(mode) { case SELECT: mode = DELETE; break; case DELETE: mode = COPY; break; case COPY: mode = PASTE; break; case PASTE: mode = SELECT; break; } } //Mode action if(kDown & KEY_X) { switch(mode) { case SELECT: { selectedEntries[(currentPath + entries[currentSelection]->name)] = !selectedEntries[(currentPath + entries[currentSelection]->name)]; printf("Toggled selection for: %s\n", (currentPath + entries[currentSelection]->name).c_str()); } break; } } if(kDown & KEY_UP) { //Easy fix until i'm bothered to fix the issue if(currentSelection < 0 | viewOffset < 0) { currentSelection = 0; viewOffset = 0; } if(viewOffset != 0) { viewOffset -= 1; currentSelection -= 1; } if(currentSelection != 0) { currentSelection -= 1; } } if(kDown & KEY_DOWN) { //Failsafe to prevent crashing if(currentSelection > entries.size()) { currentSelection = 0; viewOffset = 0; } if(currentSelection == 13 + viewOffset) { viewOffset += 1; } if(currentSelection != entries.size() - 1) { currentSelection += 1; } } if(kDown & KEY_A) { if(!entries[currentSelection]->isDirectory) { ViewFile(entries[currentSelection]->name); } else { OpenDirectory(entries[currentSelection]->name, true); } } if(kDown & KEY_B) { if(currentPath != "./") UpDirectory(); } }
void DoMenu(int Type) { int Strlen, i, x; char *sPrompt, *sPromptBak, *temp; sPrompt = calloc(81, sizeof(char)); sPromptBak = calloc(81, sizeof(char)); temp = calloc(81, sizeof(char)); TimeCheck(); switch(Type) { case 0: /* Display Prompt Line Only */ break; case 1: /* Goto another menu */ strncpy(Menus[MenuLevel], menus.OptionalData, 14); break; case 2: /* Gosub another menu */ if (MenuLevel < 49) { MenuLevel++; strncpy(Menus[MenuLevel], menus.OptionalData, 14); } else Syslog('?', "More than 50 menu levels"); break; case 3: /* Return from gosub */ if (MenuLevel > 0) MenuLevel--; break; case 4: /* Return to top menu */ MenuLevel = 0; break; case 5: /* Display .a?? file with controlcodes */ DisplayFile(menus.OptionalData); break; case 6: /* Show menu prompt */ Strlen = strlen(menus.OptionalData); for (x = 0; x < Strlen; x++) { if (menus.OptionalData[x] == '~') { strcat(sPrompt, sUserTimeleft); } else { snprintf(temp, 81, "%c", menus.OptionalData[x]); strcat(sPrompt, temp); } } strcpy(sPromptBak, sPrompt); strcpy(sPrompt, ""); Strlen = strlen(sPromptBak); for (x = 0; x < Strlen; x++) { if (*(sPromptBak + x) == '@') strcat(sPrompt, sAreaDesc); else if (*(sPromptBak + x) == '^') strcat(sPrompt, sMsgAreaDesc); else if (*(sPromptBak + x) == '#') snprintf(sPrompt, 81, "%s%s", sPrompt, (char *) GetLocalHM()); else { snprintf(temp, 81, "%c", *(sPromptBak + x)); strcat(sPrompt, temp); } } if (le_int(menus.ForeGnd) || le_int(menus.BackGnd)) pout(le_int(menus.ForeGnd), le_int(menus.BackGnd), sPrompt); else pout(WHITE, BLACK, sPrompt); break; case 7: /* Run external program */ if (strlen(menus.DoorName) && !menus.HideDoor) { memset(temp, 0, sizeof(temp)); strcpy(temp, menus.DoorName); ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, menus.NoSuid, menus.NoPrompt, menus.SingleUser, temp); } else { ExtDoor(menus.OptionalData, menus.NoDoorsys, menus.Y2Kdoorsys, menus.Comport, menus.NoSuid, menus.NoPrompt, menus.SingleUser, NULL); } break; case 8: /* Show product information */ cr(); break; case 9: /* display todays callers */ LastCallers(menus.OptionalData); break; case 10: /* display userlist */ UserList(menus.OptionalData); break; case 11: /* display time statistics */ TimeStats(); break; case 12: /* page sysop for chat */ Page_Sysop(menus.OptionalData); break; case 13: /* terminate call */ free(sPrompt); free(sPromptBak); free(temp); Good_Bye(FTNERR_OK); break; case 14: /* make a log entry */ LogEntry(menus.OptionalData); break; case 15: /* print text to screen */ if (exitinfo.Security.level >= le_int(menus.MenuSecurity.level)) { for (i = 0; i < strlen(menus.OptionalData); i++) if (*(menus.OptionalData + i) == '@') *(menus.OptionalData + i) = '\n'; snprintf(temp, 81, "%s\r\n", menus.OptionalData); PUTSTR(temp); } break; case 16: /* who's currently online */ WhosOn(menus.OptionalData); Pause(); break; case 17: /* comment to sysop */ SysopComment((char *)"Comment to Sysop"); break; case 18: /* send on-line message */ SendOnlineMsg(menus.OptionalData); break; case 19: /* display Textfile with more */ MoreFile(menus.OptionalData); break; case 20: /* display a?? file with controlcode and wait for enter */ DisplayFileEnter(menus.OptionalData); break; case 21: /* display menuline only */ break; case 22: /* Chat with any user */ Chat(NULL, NULL); break; case 101: FileArea_List(menus.OptionalData); break; case 102: File_List(); break; case 103: ViewFile(NULL); break; case 104: Download(); break; case 105: File_RawDir(menus.OptionalData); break; case 106: KeywordScan(); break; case 107: FilenameScan(); break; case 108: NewfileScan(TRUE); break; case 109: Upload(); break; case 110: EditTaglist(); break; case 111: /* View file in homedir */ break; case 112: DownloadDirect(menus.OptionalData, TRUE); break; case 113: Copy_Home(); break; case 114: List_Home(); break; case 115: Delete_Home(); break; /* 116 Unpack file in homedir */ /* 117 Pack files in homedir */ case 118: Download_Home(); break; case 119: Upload_Home(); break; case 201: MsgArea_List(menus.OptionalData); break; case 202: Post_Msg(); break; case 203: Read_Msgs(); break; case 204: CheckMail(); break; case 205: QuickScan_Msgs(); break; case 206: Delete_Msg(); break; case 207: MailStatus(); break; case 208: OLR_TagArea(); break; case 209: OLR_UntagArea(); break; case 210: OLR_ViewTags(); break; case 211: OLR_RestrictDate(); break; case 212: OLR_Upload(); break; case 213: OLR_DownBW(); break; case 214: OLR_DownQWK(); break; case 215: OLR_DownASCII(); break; case 216: Read_Email(); break; case 217: Write_Email(); break; case 218: Trash_Email(); break; case 219: Choose_Mailbox(menus.OptionalData); break; case 220: QuickScan_Email(); break; case 221: DisplayRules(); break; case 301: Chg_Protocol(); break; case 302: Chg_Password(); break; case 303: Chg_Location(); break; case 305: Chg_VoicePhone(); break; case 306: Chg_DataPhone(); break; case 307: Chg_News(); break; case 309: Chg_DOB(); break; case 310: Chg_Language(FALSE); break; case 311: Chg_Hotkeys(); break; case 312: Chg_Handle(); break; case 313: Chg_MailCheck(); break; case 314: Chg_Disturb(); break; case 315: Chg_FileCheck(); break; case 316: Chg_FsMsged(); break; case 317: Chg_FsMsgedKeys(); break; case 318: Chg_Address(); break; case 319: signature(); break; case 320: Chg_OLR_ExtInfo(); break; case 321: Chg_Charset(); break; case 322: Chg_Archiver(); break; case 401: Oneliner_Add(); break; case 402: Oneliner_List(); break; case 403: Oneliner_Show(); break; case 404: Oneliner_Delete(); break; case 405: Oneliner_Print(); break; default: Enter(1); pout(WHITE, BLACK, (char *) Language(339)); Enter(2); Syslog('?', "Option: %s -> Unknown Menu Type: %d on %s", menus.MenuKey, Type, Menus[MenuLevel]); Pause(); } free(sPrompt); free(sPromptBak); free(temp); }
void CRTFReaderTHDDlg::OnViewTextIn1() { ViewFile(m_csFile1); // ShellExecute(m_hWnd, 0, CString(CGeneral::GetTemporaryPath().c_str()) + "\\RTFIn1.txt", 0, ".", SW_SHOW); }
void CRTFReaderTHDDlg::OnViewTextOut1() { ViewFile(CString(CGeneral::GetTemporaryPath().c_str()) + _T("\\RTFOut1.rtf")); // ShellExecute(m_hWnd, 0, CString(CGeneral::GetTemporaryPath().c_str()) + "\\RTFOut1.txt", 0, ".", SW_SHOW); }
int main(int argc, char**argv) { struct sockaddr_in addr, cl_addr; int sockfd, ret, buf; char buffer[BUFSIZE]; char choice[10]; struct hostent * server; char * serverAddr; sigset_t set1, set2; sigfillset(&set1); sigfillset(&set2); sigdelset(&set2, SIGINT); sigdelset(&set2, SIGQUIT); sigprocmask(SIG_SETMASK, &set1, (void*)0); if (argc < 2) { printf("usage: client < ip address >\n"); exit(1); } serverAddr = argv[1]; sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { printf("Error creating socket!\n"); exit(1); } printf("Socket created...\n"); memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = inet_addr(serverAddr); addr.sin_port = SERV_TCP_PORT; ret = connect(sockfd, (struct sockaddr *) &addr, sizeof(addr)); if (ret < 0) { printf("Error connecting to the server!\n"); exit(1); } printf("Connected to the server...\n"); memset(buffer, 0, BUFSIZE); do{ menu(); printf("Please enter the message to sent to server [TYPE /q to EXIT]\n==> "); gets(buffer); buf = atoi(buffer); switch (buf){ case 1: createFolder(); break; case 2: createFile(); break; case 3: CopyCurrFolder(); break; case 4: CopyAnothFolder(); break; case 5: deleteFile(); break; case 6: ViewFile(); break; case 7: DownloadFile(); break; case 8: UploadFile(); break; case 9: printf("\nThank you! Please visit again...\n\n"); return; default: printf("\nInvalid Input\n\n"); } sendto(sockfd, buffer, BUFSIZE, 0, (struct sockaddr *) &addr, sizeof(addr)); printf("\n"); } while(strcmp(buffer,"/q")); if (buffer == "/q") sigprocmask(SIG_UNBLOCK, &set1, (void*)0); //explain close(sockfd); fcloseall(); return 0; } // for main function