static int delete_lines(int nrows, char *rows) { char input[4]; int first, last; DDPut(sd[ledelstr]); input[0] = 0; if (!(Prompt(input, 3, PROMPT_NOCRLF))) return -1; if ((first = str2uint(input, 1, nrows)) == -1) return nrows; DDPut(sd[ledeltostr]); input[0] = 0; if (!(Prompt(input, 3, 0))) return -1; if ((last = str2uint(input, 1, nrows)) == -1) return nrows; if (last < first) { int tmp; tmp = last; last = first; first = tmp; } memmove(rows + (first - 1) * 80, rows + last * 80, (nrows - last) * 80); return nrows - (last - first + 1); }
void Reconfigure() { fflush(stdin); Prompt("\nDo you want to \n" " Randomly generate graphs (r),\n" " Specify a graph (s),\n" " Randomly generate a maximal planar graph (m), or\n" " Randomly generate a non-planar graph (n)?"); scanf(" %c", &Mode); Mode = tolower(Mode); if (!strchr("rsmn", Mode)) Mode = 's'; if (Mode == 'r') { Message("\nNOTE: The directories for the graphs you want must exist.\n\n"); Prompt("Do you want original graphs in directory 'random' (last 10 max)?"); scanf(" %c", &OrigOut); Prompt("Do you want adj. matrix of embeddable graphs in directory 'embedded' (last 10 max))?"); scanf(" %c", &EmbeddableOut); Prompt("Do you want adj. matrix of obstructed graphs in directory 'obstructed' (last 10 max)?"); scanf(" %c", &ObstructedOut); Prompt("Do you want adjacency list format of embeddings in directory 'adjlist' (last 10 max)?"); scanf(" %c", &AdjListsForEmbeddingsOut); } FlushConsole(stdout); }
PPlugin PromptPlugin (int Type) { char filepath[MAX_PATH]; PPlugin result = (PPlugin)DialogBoxParam(hInst,MAKEINTRESOURCE(IDD_SELECTPLUGIN),topHWnd,DLG_SelectPlugin,(LPARAM)Type); if (result == NULL) return NULL; if (result->num != 9998) return result; PromptTitle = "Specify iNES mapper number (cancel for none):\r\n(-1 to skip .NES, 9999 to skip .NES and .UNIF)"; if (Prompt(topHWnd)) custplug.num = atoi(PromptResult); else custplug.num = -1; if (custplug.num != 9999) { PromptTitle = "Specify UNIF board name (cancel for none):"; if (Prompt(topHWnd)) strcpy(custplug.name,PromptResult); else if (custplug.num == -1) custplug.num = 9999; } while (1) { if (!PromptFile(topHWnd,"USB CopyNES Plugins (*.bin)\0*.bin\0\0\0\0", filepath, custplug.file, Path_PLUG, "Select a plugin (must be in Plugins path)", "bin", FALSE)) return NULL; if (strnicmp(Path_PLUG, filepath, strlen(Path_PLUG))) MessageBox(topHWnd,"Selected file is not located in Plugins directory!","Select Plugin", MB_OK | MB_ICONERROR); else break; } return &custplug; }
bool PasswdBackend::authenticate() { if (m_autologin) return true; if (m_user == "sddm") { if (m_greeter) return true; else return false; } Request r; QString password; if (m_user.isEmpty()) r.prompts << Prompt(AuthPrompt::LOGIN_USER, "Login", false); r.prompts << Prompt(AuthPrompt::LOGIN_PASSWORD, "Password", true); Request response = m_app->request(r); Q_FOREACH(const Prompt &p, response.prompts) { switch (p.type) { case AuthPrompt::LOGIN_USER: m_user = p.response; break; case AuthPrompt::LOGIN_PASSWORD: password = p.response; break; default: break; } } struct passwd *pw = getpwnam(qPrintable(m_user)); if (!pw) { m_app->error(QString("Wrong user/password combination"), Auth::ERROR_AUTHENTICATION); return false; } struct spwd *spw = getspnam(pw->pw_name); if (!spw) { qWarning() << "[Passwd] Could get passwd but not shadow"; return false; } if(!spw->sp_pwdp || !spw->sp_pwdp[0]) return true; char *crypted = crypt(qPrintable(password), spw->sp_pwdp); if (0 == strcmp(crypted, spw->sp_pwdp)) { return true; } m_app->error(QString("Wrong user/password combination"), Auth::ERROR_AUTHENTICATION); return false; }
int PromptAbortRetryIgnore(const char *qtf) { BeepExclamation(); return Prompt(callback(LaunchWebBrowser), Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, false, t_("&Abort"), t_("&Retry"), t_("&Ignore"), 0, AbortButtonImage(), RetryButtonImage(), Null); }
int PromptAbortRetryIgnore(const char *qtf, Callback HelpDlg, const char *help) { #ifdef PLATFORM_WIN32 MessageBeep(MB_ICONEXCLAMATION); #endif return Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, HelpDlg, false, t_("&Abort"), t_("&Retry"), t_("&Cancel"), help); }
void start_display_buff(char *buff) { char buffer[5]; num_members++; if (moreflg) return; if (currow >= LINES - 2) { page++; currow++; mvcur(0, 0, currow, STARTCOL); refresh(); if (Prompt("--RETURN for more, ctl-c to exit--", buffer, 1, 0) == 0) { erase_line(currow, STARTCOL); show_text(currow, STARTCOL, "Flushing query..."); moreflg = 1; return; } clrwin(DISPROW + 2); currow = DISPROW + 2; show_text(currow, STARTCOL, "continued"); currow++; } show_text(currow, STARTCOL, buff); currow++; return; }
bool FinishSave(String tmpfile, String outfile) { if(IsDeactivationSave()) { FileMove(tmpfile, outfile); return true; } Progress progress; int time = GetTickCount(); for(;;) { progress.SetTotal(10000); progress.SetText("Saving '" + GetFileName(outfile) + "'"); if(!FileExists(tmpfile)) return false; FileDelete(outfile); if(FileMove(tmpfile, outfile)) return true; IdeConsoleFlush(); Sleep(200); if(progress.SetPosCanceled((GetTickCount() - time) % progress.GetTotal())) { int art = Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(), "Unable to save current file.&" "Retry save, ignore it or save file to another location?", "Save as...", "Retry", "Ignore"); if(art < 0) return false; if(art && AnySourceFs().ExecuteSaveAs()) outfile = AnySourceFs(); progress.SetPos(0); } } }
int PromptYesNoCancel(const char *qtf) { BeepQuestion(); return Prompt(callback(LaunchWebBrowser), Ctrl::GetAppName(), CtrlImg::question(), qtf, true, t_("&Yes"), t_("&No"), t_("Cancel"), 0, YesButtonImage(), NoButtonImage(), Null); }
int PromptRetryCancel(const char *qtf) { BeepExclamation(); return Prompt(callback(LaunchWebBrowser), Ctrl::GetAppName(), CtrlImg::exclamation(), qtf, true, t_("&Retry"), t_("Cancel"), NULL, 0, RetryButtonImage(), Null, Null); }
int Prompt(Callback1<const String&> WhenLink, const char *title, const Image& icon, const char *qtf, bool okcancel, const char *button1, const char *button2, const char *button3, int cx) { return Prompt(WhenLink, title, icon, qtf, okcancel, button1, button2, button3, cx, Null, Null, Null); }
int Prompt(const char *title, const Image& icon, const char *qtf, bool okcancel, const char *button1, const char *button2, const char *button3, int cx) { return Prompt(callback(LaunchWebBrowser), title, icon, qtf, okcancel, button1, button2, button3, cx, Null, Null, Null); }
void delete_member(void) { char *argv[3]; char *buf; show_text(DISPROW, STARTCOL, "Remove yourself from a list\n"); buf = calloc(LISTMAX, 1); if (Prompt("Enter List Name: ", buf, LISTSIZE, 1) == 1) { display_buff("\n"); argv[0] = strdup(buf); argv[1] = strdup("user"); argv[2] = strdup(username); if ((status = mr_query("delete_member_from_list", 3, argv, NULL, NULL))) { display_buff("\n"); com_err(whoami, status, " found.\n"); } else { sprintf(buf, "User %s deleted from list\n", username); show_text(DISPROW + 3, STARTCOL, buf); } currow = DISPROW + 4; show_text(DISPROW + 4, STARTCOL, "Press any Key to continue..."); getchar(); free(argv[0]); free(argv[1]); free(argv[2]); } free(buf); clrwin(DISPROW); }
/** * clears the buffer history, not the command history */ void ClearHistory() { fn(ptr, SCI_SETTEXT, 0, (sptr_t)""); clearLogText(); cmdVector.clear(); Prompt(); }
bool GuiPackageResolver(const String& error, const String& path, int line) { prompt: switch(Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(), error + "&while parsing package " + DeQtf(path), "Edit \\& Retry", "Ignore", "Stop")) { case 0: if(!PromptYesNo("Ignoring will damage package. Everything past the " "point of error will be lost.&Do you want to continue ?")) goto prompt; return false; case 1: { TopWindow win; LineEdit edit; edit.Set(LoadFile(path)); edit.SetCursor(edit.GetPos(line)); win.Title(path); win.Add(edit.SizePos()); win.Run(); SaveFile(path, edit.Get()); } return true;; case -1: exit(1); } return false; }
int Shell::Run(Client* client, Server* server){ char buf[BUFFER_SIZE]; if(fgets(buf, BUFFER_SIZE, stdin) == NULL) return SHELL_EXIT; buf[strlen(buf)-1] = 0; int res = Exec(buf, client, server); if(res != SHELL_EXIT)Prompt(); return res; }
void shell_handler() { printf(" ---- Shell le coquillage de l'espace V0.1 \n"); while(1){ Prompt(); GetCmd(); if (!ExecCmd()) printf("Commande inconnu, tapez ''help'' pour voir la liste des commandes valides. \n"); } }
void CancelCommand(){ cmdVector.clear(); fn(ptr, SCI_APPENDTEXT, 1, (sptr_t)"\n"); fn(ptr, SCI_AUTOCCANCEL, 0, 0); fn(ptr, SCI_CALLTIPCANCEL, 0, 0); Prompt(); }
void CUploadViewImpl::HandleCommandL(TInt aCommand) { CALLSTACKITEM_N(_CL("CUploadViewImpl"), _CL("HandleCommandL")); iNext=false; MUploadCallBack* cb=iCallBack; iCallBack=0; if (cb) { switch(aCommand) { case Econtext_logCmdSoftkeyUpload: { TBool del=ETrue; Settings().GetSettingL(SETTING_DELETE_UPLOADED, del); MBBData* buf=MakePacketLC(); iContainer->CloseFile(); cb->Back(true, del, buf); Reporting().ShowGlobalNote(EAknGlobalConfirmationNote, _L("Queued for Upload")); CleanupStack::PopAndDestroy(); } break; case Econtext_logCmdSoftkeyCancel: iContainer->CloseFile(); cb->Back(false, false, 0); Reporting().ShowGlobalNote(EAknGlobalConfirmationNote, _L("Moved to NotShared")); break; default: return; break; } } if (!iNext && iCallBacks->iCount > 0) { iCallBack=0; TCallBackItem i=iCallBacks->Pop(); Prompt(i.iFileName, i.iCallBack); } if (!iNext) { // if no next, just display previous view iCallBack=0; TUid statusv={1}; AppUi()->ActivateLocalViewL(statusv); //CSwitchBack::NewL(iPrevView); *iNextViewId=iPrevView; } else { //if iNext -> save callback, remove view, reload it, faking previous view id MUploadCallBack* cb=iCallBack; iCallBack=0; DoDeactivate(); TUid dummy={0}; iCallBack=cb; DoActivateL(iPrevView, dummy, _L8("")); } }
void Edit_subjects_names(Sublist* sublist){ Sublist* sub_to_edit; int num_of_subjects; do{ if(num_of_subjects = Write_available_subjects(sublist)){ // if > 0 printf("\n\nWybierz przedmiot do edycji nazwy (0 dla wyjscia): "); if(sub_to_edit = Select_subject_from_sublist(num_of_subjects, sublist)){ printf("\nPodaj nowa nazwe dla wybranego przedmiotu (max %i znakow): ", MAX_SUBJ_DESC_LENGTH); Get_str(sub_to_edit->description, MIN_NAMEs_LENGTH, MAX_SUBJ_DESC_LENGTH); } else break; } } while(Prompt("\nCzy chcesz edytowac nazwy innych przedmiotow?")); }
int main(int argc, char **argv) { SetAllSignals(); switch (argc) { case 2: { if (!strcmp(argv[1], "server")) { Server(); } else { Prompt(); } break; } case 3: { if (!strcmp(argv[1], "client")) { Client(argv[2]); } else { Prompt(); } break; } default: { Prompt(); break; } } return EXIT_SUCCESS; }
void CallComplete(PARSE_STATUS_2 ps, LPARAM lParam) { inputlock = false; DebugOut("Complete:\t%d\n", GetTickCount()); switch (ps) { case PARSE2_ERROR: inputlock = true; logMessage(PARSE_ERROR_MESSAGE, strlen(PARSE_ERROR_MESSAGE), true); inputlock = false; break; case PARSE2_EXTERNAL_ERROR: inputlock = true; logMessage(EXTERNAL_ERROR_MESSAGE, strlen(EXTERNAL_ERROR_MESSAGE), true); inputlock = false; break; case PARSE2_INCOMPLETE: Prompt(CONTINUATION_PROMPT); return; default: initWordList(); break; } if (!lParam) { cmdVector.clear(); Prompt(); } DebugOut("Done:\t%d\n", GetTickCount()); }
BOOL CMD_MAKENES (void) { int i; char PRGback[MAX_PATH], CHRback[MAX_PATH], NESback[MAX_PATH]; int mapper, battery, mirror, fourscrn; char filepath[MAX_PATH], filename[MAX_PATH]; if (!PromptFile(topHWnd,"PRG data (*.PRG)\0*.prg\0\0",filepath,filename,NULL,"Select PRG segment","prg",FALSE)) return FALSE; PromptTitle = "Enter mapper number:"; if (!Prompt(topHWnd)) return FALSE; mapper = atoi(PromptResult); battery = (MessageBox(topHWnd,"Battery-backed RAM?",MSGBOX_TITLE,MB_YESNO | MB_ICONQUESTION) == IDYES); mirror = (MessageBox(topHWnd,"Vertical mirroring?",MSGBOX_TITLE,MB_YESNO | MB_ICONQUESTION) == IDYES); fourscrn = (MessageBox(topHWnd,"4-screen VRAM?",MSGBOX_TITLE,MB_YESNO | MB_ICONQUESTION) == IDYES); strcpy(PRGback,Path_PRG); strcpy(CHRback,Path_CHR); strcpy(NESback,Path_NES); i = strlen(filepath); while (i > 0) if (filepath[--i] == '\\') { filepath[++i] = 0; break; } i = strlen(filename); while (i > 0 && filename[i] != '.') i--; if (i) filename[i] = 0; strcpy(Path_PRG,filepath); strcpy(Path_CHR,filepath); strcpy(Path_NES,filepath); WriteNES(filename, mapper, battery, mirror, fourscrn); strcpy(Path_PRG,PRGback); strcpy(Path_CHR,CHRback); strcpy(Path_NES,NESback); return FALSE; }
// Read one line from the console wchar_t *ConsoleLocalReadLine(CONSOLE *c, wchar_t *prompt, bool nofile) { wchar_t *ret; LOCAL_CONSOLE_PARAM *p; // Validate arguments if (c == NULL) { return NULL; } p = (LOCAL_CONSOLE_PARAM *)c->Param; if (prompt == NULL) { prompt = L">"; } ConsoleWriteOutFile(c, prompt, false); if (nofile == false && p->InBuf != NULL) { // Read the next line from the file ret = ConsoleReadNextFromInFile(c); if (ret != NULL) { // Display the pseudo prompt UniPrint(L"%s", prompt); // Display on the screen UniPrint(L"%s\n", ret); } } else { // Read the following line from the console ret = Prompt(prompt); } if (ret != NULL) { ConsoleWriteOutFile(c, ret, true); } else { ConsoleWriteOutFile(c, _UU("CON_USER_CANCEL"), true); } return ret; }
char *PromptA(wchar_t *prompt_str) { wchar_t *str = Prompt(prompt_str); if (str == NULL) { return NULL; } else { char *ret = CopyUniToStr(str); Free(str); return ret; } }
void Init(clock_t &tLast) { setlocale(LC_CTYPE, "Spanish"); //Set acentos tLast = clock(); bag.SetName(BAG); bag.SetDescription(BAG_DESC); bag.SetLatitude(0); bag.SetLongitude(0); bag.SetState('s'); bag.ilist.Push((std::string)"llave", (std::string)"Una llave de acero oxidada"); //objeto no lo pongo en las strings de constants.h colortext(YELLOW); printf(MISSION); NewRoom(); Prompt(); gameState = loop; }
void GetNumberIfZero(int *pNum, char *prompt, int min, int max) { if (*pNum == 0) { Prompt(prompt); scanf(" %d", pNum); } if (min < 1) min = 1; if (max < min) max = min; if (*pNum < min || *pNum > max) { *pNum = (max + min) / 2; sprintf(Line, "Number out of range [%d, %d]; changed to %d\n", min, max, *pNum); ErrorMessage(Line); } }
void edituser(void) { char askbuf[20]; changenodestatus("Editing personal data"); TypeFile("edituser", TYPE_MAKE | TYPE_WARN); for (;;) { DDPut(sd[eupromptstr]); askbuf[0] = 0; if (!(Prompt(askbuf, 3, 0))) return; if (handle_choice(askbuf)) return; } }
/* * Expects an empty prompt list if the previous request has been processed */ bool PamData::insertPrompt(const struct pam_message* msg, bool predict) { Prompt &p = findPrompt(msg); // first, check if we already have stored this propmpt if (p.valid()) { // we have a response already - do nothing if (m_sent) return false; // we don't have a response yet - replace the message and prepare to send it p.message = QString::fromLocal8Bit(msg->msg); return true; } // this prompt is not stored but we have some prompts else if (m_currentRequest.prompts.length() != 0) { // check if we have already sent this - if we did, get rid of the answers if (m_sent) { m_currentRequest.clear(); m_sent = false; } } // we'll predict what will come next if (predict) { AuthPrompt::Type type = detectPrompt(msg); switch (type) { case AuthPrompt::LOGIN_USER: m_currentRequest = Request(loginRequest); return true; case AuthPrompt::CHANGE_CURRENT: m_currentRequest = Request(changePassRequest); return true; case AuthPrompt::CHANGE_NEW: m_currentRequest = Request(changePassNoOldRequest); return true; default: break; } } // or just add whatever comes exactly as it comes m_currentRequest.prompts.append(Prompt(detectPrompt(msg), QString::fromLocal8Bit(msg->msg), msg->msg_style == PAM_PROMPT_ECHO_OFF)); return true; }
static int syspw(void) { char b[80]; int i; if (*maincfg.CFG_SYSTEMPW) { TypeFile("systempassword", TYPE_MAKE); for (i = 2; i; i--) { *b = 0; DDPut(sd[syspwstr]); if (!(Prompt(b, 16, PROMPT_SECRET))) return 0; if (!strcasecmp(b, maincfg.CFG_SYSTEMPW)) return 1; } return 0; } return 1; }