i4 Is_it_If_statement(FILE *testFile,i4 *counter,bool Ignore_it) { char *cp1 = NULL ; char *cp2 = NULL ; i4 cmd ; bool yes_its_if = FALSE ; bool yes_its_tc = FALSE ; cmd = 0; if ((!shellMode)&&(SEP_CMstlen(lineTokens[0],0) > 1)&& (CMcmpcase(lineTokens[0],ERx(".")) == 0)) { cp1 = buffer_1 ; /* Fix the ".if" statement. */ cp2 = buffer_2 ; STcopy(buffer_1, holdBuf); CMcpyinc(cp1,cp2); CMcpychar(ERx(" "),cp2); CMnext(cp2); STcopy(cp1, cp2); STcopy(buffer_2, buffer_1); break_line(buffer_2, counter, lineTokens); } cmd = classify_cmmd(sepcmmds, lineTokens[1]); if (cmd == IF_CMMD || cmd == ELSE_CMMD || cmd == ENDIF_CMMD) { yes_its_if = TRUE; } else if (cmd == TEST_CASE_CMMD || cmd == TEST_CASE_END_CMMD) { yes_its_tc = TRUE; } if (yes_its_if || yes_its_tc) { append_line(holdBuf, 0); if (Ignore_it) ignore_silent == TRUE; if (yes_its_if) { process_if(testFile, lineTokens, cmd); } else if (yes_its_tc) { if (cmd == TEST_CASE_CMMD) { testcase_start(&lineTokens[1]); } else if (cmd == TEST_CASE_END_CMMD) { testcase_end(FALSE); } } if (Ignore_it) ignore_silent == FALSE; } else { cmd = 0; } return (cmd); }
VOID get_string(WINDOW *wndow,char *question,char *ansbuff) { char *prompt = NULL ; char tempBuffer [TERM_LINE] ; char *cp = ansbuff ; char *cptr = NULL ; i4 clen ; register i4 i ; prompt = SEP_MEalloc(SEP_ME_TAG_NODEL, STlength(question)+5, TRUE, (STATUS *) NULL); STprintf(prompt, ERx("%s "), question); put_message(wndow, prompt); getstr(wndow, tempBuffer, FALSE); /* check if continuation character was entered */ cptr = SEP_CMlastchar(tempBuffer,0); if (CMcmpcase(cptr,cont_char) == 0) { *cptr = EOS; STcopy(tempBuffer,cp); clen = SEP_CMstlen(tempBuffer,0); for (i=0; i<clen; i++) CMnext(cp); TDerase(wndow); STprintf(tempBuffer, ERx("%s%s"), prompt, ansbuff); SEPprintw(wndow, PROMPT_ROW - 1, PROMPT_COL, tempBuffer); STprintf(prompt, ERx("%s%s"), question, cont_char); SEPprintw(wndow, PROMPT_ROW, PROMPT_COL, prompt); TDrefresh(wndow); getstr(wndow,tempBuffer,FALSE); /* check if continuation character was entered */ cptr = SEP_CMlastchar(tempBuffer,0); if (CMcmpcase(cptr,cont_char) == 0) { i4 temp; *cptr = EOS; STprintf(prompt, ERx("%s %s"), question, tempBuffer); SEPprintw(wndow, PROMPT_ROW, PROMPT_COL, prompt); STcopy(tempBuffer, cp); STprintf(prompt, ERx("%s%s"), question, cont_char); SEPprintw(wndow, PROMPT_ROW + 1, PROMPT_COL, prompt); /* ** ugly fix to prevent the screen from scrolling when ** typing to the last line of the screen. It will hopefully ** be changed in the future for a more elegant solution */ temp = LINES; LINES++; TDrefresh(wndow); getstr(wndow, tempBuffer, FALSE); disp_prompt((char *)NULLSTR, (char *)NULL, (char *)NULL); LINES = temp; } } MEfree(prompt); STcopy(tempBuffer, cp); TDerase(wndow); TDrefresh(wndow); }