/* ** subtest_mir(test_list, status, ch) ** ** (mir) move in insert mode */ static void subtest_mir( struct test_list *t, int *state, int *ch) { int i; char *s; if (enter_insert_mode && exit_insert_mode && cursor_address) { put_clear(); i = line_count; put_str("\nXXX\nXXX\nXXX\nXXX"); tc_putp(enter_insert_mode); s = tparm(cursor_address, i + 1, 0); tputs(s, lines, tc_putch); putchp('X'); s = tparm(cursor_address, i + 2, 1); tputs(s, lines, tc_putch); putchp('X'); s = tparm(cursor_address, i + 3, 2); tputs(s, lines, tc_putch); putchp('X'); s = tparm(cursor_address, i + 4, 3); tputs(s, lines, tc_putch); putchp('X'); tc_putp(exit_insert_mode); put_newlines(2); ptextln("If you see a 4 by 4 block of X's then (mir) should be true."); sprintf(temp, "(mir) Move-in-insert-mode is %s in the data base", move_insert_mode ? "true" : "false"); ptextln(temp); } else { ptext("(mir) Move-in-insert-mode not tested, "); if (!enter_insert_mode) { ptext("(smir) "); } if (!exit_insert_mode) { ptext("(rmir) "); } if (!cursor_address) { ptext("(cup) "); } ptext("not present. "); } generic_done_message(t, state, ch); }
/* ** subtest_msgr(test_list, status, ch) ** ** (msgr) move in sgr mode */ static void subtest_msgr( struct test_list *t, int *state, int *ch) { int i; if (cursor_address && ((enter_standout_mode && exit_standout_mode) || (enter_alt_charset_mode && exit_alt_charset_mode))) { put_crlf(); i = line_count + 1; tputs(tparm(cursor_address, i, 0), lines, tc_putch); put_mode(enter_alt_charset_mode); put_crlf(); /* some versions of the wy-120 can not clear lines or screen when in alt charset mode. If (el) and (ed) are defined then I can test them. If they are not defined then they can not break (msgr) */ tc_putp(clr_eos); tc_putp(clr_eol); put_mode(exit_alt_charset_mode); put_mode(enter_standout_mode); putchp('X'); tputs(tparm(cursor_address, i + 2, 1), lines, tc_putch); putchp('X'); tputs(tparm(cursor_address, i + 3, 2), lines, tc_putch); putchp('X'); tputs(tparm(cursor_address, i + 4, 3), lines, tc_putch); putchp('X'); put_mode(exit_standout_mode); put_crlf(); tc_putp(clr_eos); /* OK if missing */ put_crlf(); ptextln("If you see a diagonal line of standout X's then (msgr) should be true. If any of the blanks are standout then (msgr) should be false."); sprintf(temp, "(msgr) Move-in-SGR-mode is %s in the data base", move_standout_mode ? "true" : "false"); ptextln(temp); } else { ptextln("(smso) (rmso) (smacs) (rmacs) missing; (msgr) Move-in-SGR-mode not tested."); } generic_done_message(t, state, ch); }
/* ** funkey_prog(test_list, status, ch) ** ** Test program function keys (pfx) */ static void funkey_prog( TestList * t, int *state, int *ch) { if (pkey_xmit) { int i; int fk = 1; char mm[256]; /* test program function key */ sprintf(temp, "(pfx) Set function key %d to transmit abc\\n", fk); ptextln(temp); tc_putp(TPARM_2(pkey_xmit, fk, "abc\n")); sprintf(temp, "Hit function key %d\n", fk); ptextln(temp); memset(mm, 0, (size_t) 4); for (i = 0; i < 4; ++i) { int cc = getchp(STRIP_PARITY); if (cc == EOF) break; mm[i] = (char) cc; } mm[i] = '\0'; put_crlf(); if (mm[0] != 'a' || mm[1] != 'b' || mm[2] != 'c') { sprintf(temp, "Error string received was: %s", expand(mm)); ptextln(temp); } else { putln("Thank you\n"); } flush_input(); if (key_f1) { tc_putp(TPARM_2(pkey_xmit, fk, key_f1)); } } else { ptextln("Function key transmit (pfx), not present."); } generic_done_message(t, state, ch); }
/* ** subtest_xhp(test_list, status, ch) ** ** (xhp) erase does not clear standout mode */ static void subtest_xhp( struct test_list *t, int *state, int *ch) { if (enter_standout_mode) { put_crlf(); put_mode(enter_standout_mode); put_str("Stand out"); put_mode(exit_standout_mode); put_cr(); ptextln("If any part of this line is standout then (xhp) should be set."); sprintf(temp, "(xhp) Erase-standout-glitch is %s in the data base", ceol_standout_glitch ? "true" : "false"); ptextln(temp); generic_done_message(t, state, ch); } }
/* ** subtest_am(test_list, status, ch) ** ** test automatic margins (am) */ static void subtest_am( struct test_list *t, int *state, int *ch) { int i, j; if (!can_go_home) { ptextln("(am) not tested, no way to home cursor. "); } else if (over_strike) { put_clear(); go_home(); ptext("\n(am) should "); i = char_count; ptext("not be set"); go_home(); for (j = -i; j < columns; j++) put_this(' '); put_str("@@@"); go_home(); put_newlines(2); sprintf(temp, "(am) is %s in the data base", auto_right_margin ? "true" : "false"); ptextln(temp); } else { put_clear(); go_home(); ptext("\n(am) should not be set"); go_home(); for (j = 0; j < columns; j++) put_this(' '); ptext("(am) should be set "); go_home(); put_str(" \n\n"); sprintf(temp, "(am) is %s in the data base", auto_right_margin ? "true" : "false"); ptextln(temp); } ptext("Automatic-right-margin "); generic_done_message(t, state, ch); }
/* ** crum_clear(test_list, status, ch) ** ** (clear) test Clear screen */ static void crum_clear( struct test_list *t, int *state, int *ch) { int i; if (clear_screen) { for (i = lines; i > 1; i--) { putln("garbage"); } put_clear(); ptextln("This line should start in the home position."); ptext("The rest of the screen should be clear. "); } else { ptextln("(clear) Clear screen is not defined. "); } generic_done_message(t, state, ch); }
/* ** subtest_ul(test_list, status, ch) ** ** test transparent underline (ul) */ static void subtest_ul( struct test_list *t, int *state, int *ch) { if (!over_strike) { /* (ul) is used only if (os) is reset */ put_crlf(); sprintf(temp, "This text should %sbe underlined.", transparent_underline ? "" : "not "); uprint(temp); put_crlf(); ptextln("If the above line is not underlined the (ul) should be false."); sprintf(temp, "(ul) Transparent-underline is %s in the data base", transparent_underline ? "true" : "false"); ptextln(temp); generic_done_message(t, state, ch); } }
/* ** subtest_eo(test_list, status, ch) ** ** (eo) erase overstrike */ static void subtest_eo( struct test_list *t, int *state, int *ch) { if (transparent_underline || over_strike || underline_char) { ptext("(eo) should "); if (underline_char) { ucprint("not"); } else { uprint("not"); } put_cr(); ptextln("(eo) should be set"); sprintf(temp, "\n(eo) Erase-overstrike is %s in the data base", erase_overstrike ? "true" : "false"); ptextln(temp); generic_done_message(t, state, ch); } }
/* ** dump_test_stats(test_list, status, ch) ** ** Dump the statistics about the last test */ void dump_test_stats( struct test_list *t, int *state, int *ch) { int i, j; char tbuf[32]; int x[32]; put_crlf(); if (tx_source && tx_source->caps_done) { cap_index(tx_source->caps_done, x); if (x[0] >= 0) { sprintf(temp, "Caps summary for (%s)", tx_source->caps_done); ptextln(temp); for (i = 0; x[i] >= 0; i++) { show_cap_results(x[i]); } put_crlf(); } } sprintf(tbuf, "%011u", usec_run_time); sprintf(temp, "Test time: %d.%s, characters per second %d, characters %d", usec_run_time / 1000000, &tbuf[5], tx_cps, tx_characters); ptextln(temp); for (i = 0; i < txp; i++) { if ((j = get_string_cap_byvalue(tx_cap[i])) >= 0) { sprintf(tbuf, "(%s)", strnames[j]); } else { strcpy(tbuf, "(?)"); } sprintf(temp, "%8d %3d $<%3d> %8s %s", tx_count[i], tx_affected[i], tx_delay[i], tbuf, expand(tx_cap[i])); putln(temp); } generic_done_message(t, state, ch); }
/* ** sync_test(menu) ** ** Run at the beginning of the pad tests and function key tests */ void sync_test( struct test_menu *menu) { control_init(); if (tty_can_sync == SYNC_NOT_TESTED) { verify_time(); } if (menu->menu_title) { put_crlf(); ptextln(menu->menu_title); } }
/* ** subtest_in(test_list, status, ch) ** ** (in) insert null glitch */ static void subtest_in( struct test_list *t, int *state, int *ch) { if (enter_insert_mode && exit_insert_mode) { ptextln("\nTesting (in) with (smir) and (rmir)"); putln("\tIf these two lines line up ..."); put_str("\tIf these two lines line up ..."); put_cr(); tc_putp(enter_insert_mode); putchp(' '); tc_putp(exit_insert_mode); ptext("\nthen (in) should be set. "); sprintf(temp, "(in) Insert-null-glitch is %s in the data base.", insert_null_glitch ? "true" : "false"); ptextln(temp); generic_done_message(t, state, ch); } }
/* ** subtest_bw(test_list, status, ch) ** ** test auto left margin (bw) */ static void subtest_bw( struct test_list *t, int *state, int *ch) { int i, j; if (over_strike) { /* test (bw) */ ptext("\n(bw) should "); i = char_count; ptextln("not be set."); for (j = i; j < columns; j++) put_str("\b"); put_str("@@@"); put_crlf(); sprintf(temp, "(bw) Auto-left-margin is %s in the data base", auto_left_margin ? "true" : "false"); ptextln(temp); } else { /* test (bw) */ ptextln("(bw) should not be set."); for (i = 12; i < columns; i++) put_str("\b"); if (delete_character) { for (i = 0; i < 4; i++) tc_putp(delete_character); } else { put_str(" "); } put_crlf(); sprintf(temp, "(bw) Auto-left-margin is %s in the data base", auto_left_margin ? "true" : "false"); ptextln(temp); } generic_done_message(t, state, ch); }
/* ** subtest_cbt(test_list, status, ch) ** ** (cbt) back tab */ static void subtest_cbt( struct test_list *t, int *state, int *ch) { int i; if (back_tab) { put_clear(); ptext("Back-tab (cbt)"); go_home(); put_crlf(); for (i = 1; i < columns; i++) { putchp(' '); } for (i = 0; i < columns; i += 8) { tc_putp(back_tab); putchp('T'); tc_putp(back_tab); } go_home(); put_newlines(2); for (i = 1; i < columns; i++) { if (i % 8 == 1) { putchp('T'); } else { putchp(' '); } } go_home(); put_newlines(3); ptextln("The preceding two lines should be the same."); } else { ptextln("(cbt) Back-tab not present"); } generic_done_message(t, state, ch); }
/* ** subtest_os(test_list, status, ch) ** ** test over strike mode (os) */ static void subtest_os( struct test_list *t, int *state, int *ch) { ptext("(os) should be true, not false."); put_cr(); ptextln("(os) should be false."); sprintf(temp, "(os) over-strike is %s in the data base. ", over_strike ? "true" : "false"); ptext(temp); generic_done_message(t, state, ch); }
/* ** crum_home(test_list, status, ch) ** ** (home) test Home cursor */ static void crum_home( struct test_list *t, int *state, int *ch) { if (cursor_home) { put_clear(); put_newlines(lines / 2); go_home(); put_crlf(); ptext("The bottom line should have text."); go_home(); put_newlines(lines - 1); ptext("This line is on the bottom."); go_home(); ptextln("This line starts in the home position."); put_crlf(); } else { ptextln("(home) Home cursor is not defined. "); } generic_done_message(t, state, ch); }
/* ** funkey_meta(test_list, status, ch) ** ** Test meta key (km) (smm) (rmm) */ static void funkey_meta( TestList * t, int *state, int *ch) { if (has_meta_key) { int i, j, k, len; char outbuf[256]; put_crlf(); if (char_mask != ALLOW_PARITY) { if (tty_meta_prep()) { ptext("\nHit any key to continue > "); (void) wait_here(); put_crlf(); } } ptext("Begin meta key test. (km) (smm) (rmm) Hit any key"); ptext(" with the meta key. The character will be"); ptext(" displayed in hex. If the meta key is working"); ptext(" then the most significant bit will be set. Type"); ptextln(" 'end' to exit."); tty_raw(1, ALLOW_PARITY); tc_putp(meta_on); for (i = j = k = len = 0; i != 'e' || j != 'n' || k != 'd';) { i = j; j = k; k = getchp(ALLOW_PARITY); if (k == EOF) { break; } if ((len += 3) >= columns) { put_crlf(); len = 3; } sprintf(outbuf, "%02X ", k); put_str(outbuf); k &= STRIP_PARITY; } tc_putp(meta_off); put_crlf(); tty_set(); put_crlf(); } else { ptext("(km) Has-meta-key is not set. "); } generic_done_message(t, state, ch); }
/* ** funkey_label(test_list, status, ch) ** ** Test labels (nlab) (smln) (pln) (rmln) (lw) (lh) */ static void funkey_label( TestList * t, int *state, int *ch) { if (num_labels == -1) { ptextln("Your terminal has no labels. (nlab)"); } else { int i; int my_width = label_width; char outbuf[256]; sprintf(temp, "Your terminal has %d labels (nlab) that are %d characters wide (lw) and %d lines high (lh)", num_labels, my_width, label_height); ptext(temp); ptextln(" Testing (smln) (pln) (rmln)"); if (label_on) { tc_putp(label_on); } if (my_width <= 0) { my_width = sizeof(outbuf) - 1; } for (i = 1; i <= num_labels; i++) { sprintf(outbuf, "L%d..............................", i); outbuf[my_width] = '\0'; tc_putp(TPARM_2(plab_norm, i, outbuf)); } if (label_off) { ptext("Hit any key to remove the labels: "); (void) wait_here(); tc_putp(label_off); } } generic_done_message(t, state, ch); }
/* ** funkey_prog(test_list, status, ch) ** ** Test program function keys (pfx) */ static void funkey_prog( struct test_list *t, int *state, int *ch) { int i, fk; char mm[256]; fk = 1; /* use function key 1 for now */ if (pkey_xmit) { /* test program function key */ sprintf(temp, "(pfx) Set function key %d to transmit abc\\n", fk); ptextln(temp); tc_putp(TPARM_2(pkey_xmit, fk, "abc\n")); sprintf(temp, "Hit function key %d\n", fk); ptextln(temp); for (i = 0; i < 4; ++i) mm[i] = (char) getchp(STRIP_PARITY); mm[i] = '\0'; put_crlf(); if (mm[0] != 'a' || mm[1] != 'b' || mm[2] != 'c') { sprintf(temp, "Error string received was: %s", expand(mm)); ptextln(temp); } else { putln("Thank you\n"); } flush_input(); if (key_f1) { tc_putp(TPARM_2(pkey_xmit, fk, key_f1)); } } else { ptextln("Function key transmit (pfx), not present."); } generic_done_message(t, state, ch); }
/* ** get_next_block() ** ** Get a results block for pad test data. */ static struct test_results * get_next_block(void) { if (blocks <= 0) { results = (struct test_results *) malloc(sizeof(struct test_results) * RESULT_BLOCK); if (!results) { ptextln("Malloc failed"); return (struct test_results *) 0; } blocks = RESULT_BLOCK; } blocks--; return results++; }
int tty_meta_prep(void) { /* print a warning before the meta key test */ if (not_a_tty) { return 0; } if (initial_stty_query(TTY_8_BIT)) { return 0; } ptext("The meta key test must be run with the"); ptext(" terminal set for 8 data bits. Two stop bits"); ptext(" may also be needed for correct display. I will"); ptext(" transmit 8 bit data but if the terminal is set for"); ptextln(" 7 bit data, garbage may appear on the screen."); return 1; }
/* ** printer_mc0(test_list, status, ch) ** ** Test screen print (mc0) */ static void printer_mc0( TestList * t, int *state, int *ch) { if (print_screen) { ptext("I am going to send the contents of the screen to"); ptext(" the printer, then wait for a keystroke from you."); ptext(" All of the text that appears on the screen"); ptextln(" should be printed. (mc0)"); tc_putp(print_screen); } else { ptext("(mc0) Print-screen is not present. "); } generic_done_message(t, state, ch); }
/* ** pad_standard(test_list, status, ch) ** ** Run a single cap pad test. */ static void pad_standard( struct test_list *t, int *state, int *ch) { const char *long_name; char *cap; int l = 2, i; char tbuf[128]; if ((cap = get_string_cap_byname(t->caps_done, &long_name))) { sprintf(tbuf, "(%s) %s, start testing", t->caps_done, long_name); if (skip_pad_test(t, state, ch, tbuf)) { return; } i = 1; pad_test_startup(1); do { if (i >= columns) { page_loop(); l++; i = 1; } tt_putp(cap); putchp(letter); i++; } while(still_testing()); pad_test_shutdown(t, 0); if (l >= lines) { home_down(); } else { put_crlf(); } ptextln(no_visual); } else { CAP_NOT_FOUND; /* Note: get_string_cap_byname() always sets long_name */ sprintf(temp, "(%s) %s, not present. ", t->caps_done, long_name); ptext(temp); } pad_done_message(t, state, ch); }
/* ** subtest_uc(test_list, status, ch) ** ** test underline character (uc) */ static void subtest_uc( struct test_list *t, int *state, int *ch) { if (!over_strike) { if (underline_char) { ucprint("This text should be underlined."); put_crlf(); ptextln("If the above text is not underlined the (uc) has failed."); ptext("Underline-character "); } else { ptext("(uc) underline-character is not defined. "); } generic_done_message(t, state, ch); } }
/* ** crum_ll(test_list, status, ch) ** ** (ll) test Last line */ static void crum_ll( struct test_list *t, int *state, int *ch) { /* (ll) may be simulated with (cup). Don't complain if (cup) is present. */ if (cursor_to_ll) { put_clear(); put_str("This line could be anywhere."); tc_putp(cursor_to_ll); ptext("This line should be on the bottom"); go_home(); put_crlf(); } else if (cursor_address) { return; } else { ptextln("(ll) Move to last line is not defined. "); } generic_done_message(t, state, ch); }
/* ** printer_on(test_list, status, ch) ** ** Test printer on/off (mc4) (mc5) (mc5i) */ static void printer_on( TestList * t, int *state, int *ch) { if (!prtr_on || !prtr_off) { ptextln("Printer on/off missing. (mc5) (mc4)"); } else if (prtr_silent) { ptextln("Your printer is silent. (mc5i) is set."); tc_putp(prtr_on); ptextln("This line should be on the printer but not your screen. (mc5)"); tc_putp(prtr_off); ptextln("This line should be only on the screen. (mc4)"); } else { ptextln("Your printer is not silent. (mc5i) is reset."); tc_putp(prtr_on); ptextln("This line should be on the printer and the screen. (mc5)"); tc_putp(prtr_off); ptextln("This line should only be on the screen. (mc4)"); } generic_done_message(t, state, ch); }
/* ** subtest_xenl(test_list, status, ch) ** ** (xenl) eat newline glitch */ static void subtest_xenl( struct test_list *t, int *state, int *ch) { int i, j, k; if (over_strike) { /* test (xenl) on overstrike terminals */ if (!can_go_home || !can_clear_screen) { ptextln("(xenl) Newline-glitch not tested, can't home cursor and clear."); generic_done_message(t, state, ch); return; } put_clear(); /* this test must be done in raw mode. Otherwise UNIX will translate CR to CRLF. */ if (stty_query(TTY_OUT_TRANS)) tty_raw(1, char_mask); ptext("\nreset (xenl). Does "); i = char_count; put_str("not ignore CR, does "); k = char_count; put_str("not ignore LF"); go_home(); for (j = 0; j < columns; j++) put_this(' '); put_cr(); for (j = 0; j < i; j++) putchp(' '); put_str("@@@\n@@"); go_home(); for (j = 0; j < columns; j++) put_this(' '); put_lf(); for (j = 0; j < k; j++) putchp(' '); put_str("@@@\r@@"); tty_set(); go_home(); put_newlines(4); sprintf(temp, "(xenl) Newline-glitch is %s in the data base", eat_newline_glitch ? "true" : "false"); ptextln(temp); } else { /* test (xenl) when (os) is reset */ if (!can_go_home) { ptextln("(xenl) Newline-glitch not tested, can't home cursor"); generic_done_message(t, state, ch); return; } /* (xenl) test */ put_clear(); /* this test must be done in raw mode. Otherwise UNIX will translate CR to CRLF. */ if (stty_query(TTY_OUT_TRANS)) tty_raw(1, char_mask); for (j = 0; j < columns; j++) put_this(' '); put_cr(); ptext("(xenl) should be set. Does not ignore CR"); go_home(); put_crlf(); for (j = 0; j < columns; j++) put_this(' '); put_lf(); /* test (cud1) */ ptext("(xenl) should be set. Ignores (cud1)"); go_home(); put_newlines(3); if (scroll_forward && cursor_down && strcmp(scroll_forward, cursor_down)) { for (j = 0; j < columns; j++) put_this(' '); put_ind(); /* test (ind) */ ptext("(xenl) should be set. Ignores (ind)"); go_home(); put_newlines(5); } tty_set(); ptextln("If you don't see text above telling you to set it, (xenl) should be false"); sprintf(temp, "(xenl) Newline-glitch is %s in the data base", eat_newline_glitch ? "true" : "false"); ptextln(temp); } generic_done_message(t, state, ch); }
/* ** keys_tested(first-time, show-help, hex-output) ** ** Display a list of the keys not tested. */ static void keys_tested( int first_time, int show_help, int hex_output) { int i, l; char outbuf[256]; alloc_strings(); put_clear(); tty_set(); flush_input(); if (got_labels) { putln("Function key labels:"); for (i = 0; i < key_count; ++i) { if (fk_label[i]) { sprintf(outbuf, "%s %s", fk_name[i] ? fk_name[i] : "??", fk_label[i]); put_columns(outbuf, (int) strlen(outbuf), 16); } } put_newlines(2); } if (funk) { putln("The following keys are not defined:"); for (i = 0; i < funk; ++i) { put_columns(fk_unknown[i], fk_length[i], 16); } put_mode(exit_attribute_mode); put_newlines(2); } if (first_time) { putln("The following keys are defined:"); } else { putln("The following keys have not been tested:"); } if (scan_mode) { for (i = 0; scan_down[i]; i++) { if (!scan_tested[i]) { if (hex_output) { strcpy(outbuf, hex_expand_to(scan_down[i], 3)); } else { strcpy(outbuf, expand(scan_down[i])); } l = expand_chars; if (hex_output) { strcat(outbuf, hex_expand_to(scan_up[i], 3)); } else { strcat(outbuf, expand(scan_up[i])); } expand_chars += l; l = (int) strlen(scan_name[i]); if (((char_count + 16) & ~15) + ((expand_chars + 7) & ~7) + l >= columns) { put_crlf(); } else if (char_count + 24 > columns) { put_crlf(); } else if (char_count) { putchp(' '); } put_columns(outbuf, expand_chars, 16); put_columns(scan_name[i], l, 8); } } } else { for (i = 0; i < key_count; i++) { if (!fk_tested[i] && fk_name[i] != 0) { if (hex_output) { strcpy(outbuf, hex_expand_to(fkval[i], 3)); } else { strcpy(outbuf, expand(fkval[i])); } l = (int) strlen(fk_name[i]); if (((char_count + 16) & ~15) + ((expand_chars + 7) & ~7) + l >= columns) { put_crlf(); } else if (char_count + 24 > columns) { put_crlf(); } else if (char_count) { putchp(' '); } put_columns(outbuf, expand_chars, 16); put_columns(fk_name[i], l, 8); } } } put_newlines(2); if (show_help) { ptextln("Hit any function key. Type 'end' to quit. Type ? to update the display."); put_crlf(); } }
/* ** subtest_hts(test_list, status, ch) ** ** (ht) and set tabs with (hts) */ static void subtest_hts( struct test_list *t, int *state, int *ch) { int tabat; /* the tab spacing we end up with */ int i; tabat = init_tabs; if (set_tab) { ptext("Tabs set with (hts)"); put_crlf(); for (i = 1; i < columns; i++) { if (i % 8 == 1) { tc_putp(set_tab); } putchp(' '); } tabat = 8; } else { sprintf(temp, "(hts) Set-tabs not defined. (it) Initial-tabs at %d", init_tabs); ptext(temp); } go_home(); put_newlines(2); if (tabat <= 0) { tabat = 8; } for (i = tabat; i < columns; i += tabat) { putchp('\t'); putchp('T'); } go_home(); put_newlines(3); for (i = 1; i < columns; i++) { putchp('.'); } go_home(); put_newlines(3); for (i = tabat; i < columns; i += tabat) { putchp('\t'); putchp('T'); } go_home(); put_newlines(4); putchp('.'); for (i = 2; i < columns; i++) { if (i % tabat == 1) { putchp('T'); } else { putchp('.'); } } go_home(); put_newlines(5); if (set_tab) { ptextln("If the last two lines are not the same then (hts) has failed."); } else if (init_tabs > 0) { ptextln("If the last two lines are not the same then (it) is wrong."); } else { ptextln("If the last two lines are the same then maybe you do have tabs and (it) should be changed."); } generic_done_message(t, state, ch); }
/* ** curses_setup(exec_name) ** ** Startup ncurses */ void curses_setup( char *exec_name) { int status; static TERMTYPE term; char tty_filename[2048]; tty_init(); /** See if the terminal is in the terminfo data base. This call has two useful benefits, 1) it returns the filename of the terminfo entry, and 2) it searches only terminfo's. This allows us to abort before ncurses starts scanning the termcap file. **/ if ((status = _nc_read_entry(tty_basename, tty_filename, &term)) == 0) { const TERMTYPE *fallback = _nc_fallback(tty_basename); if (fallback) { term = *fallback; sprintf(tty_filename, "(fallback)%s", tty_basename); status = 1; } else { fprintf(stderr, "Terminal not found: TERM=%s\n", tty_basename); show_usage(exec_name); exit(1); } } if (status == -1) { fprintf(stderr, "Terminfo database is inaccessible\n"); exit(1); } /** This call will load the terminfo data base and set the cur-term variable. Only terminals that actually exist will get here so its OK to ignore errors. This is a good thing since ncurses does not permit (os) or (gn) to be set. **/ setupterm(tty_basename, 1, &status); /** Get the current terminal definitions. This must be done before getting the baudrate. **/ _nc_get_curterm(&cur_term->Nttyb); tty_baud_rate = baudrate(); tty_cps = (tty_baud_rate << 1) / tty_frame_size; /* set up the defaults */ replace_mode = TRUE; scan_mode = 0; char_count = 0; select_delay_type = debug_level = 0; char_mask = (meta_on && meta_on[0] == '\0') ? ALLOW_PARITY : STRIP_PARITY; /* Don't change the XON/XOFF modes yet. */ select_xon_xoff = initial_stty_query(TTY_XON_XOFF) ? 1 : needs_xon_xoff; fflush(stdout); /* flush any output */ tty_set(); go_home(); /* set can_go_home */ put_clear(); /* set can_clear_screen */ if (send_reset_init) { reset_init(); } /* I assume that the reset and init strings may not have the correct pads. (Because that part of the test comes much later.) Because of this, I allow the terminal some time to catch up. */ fflush(stdout); /* waste some time */ sleep(1); /* waste more time */ charset_can_test(); can_test("lines cols cr nxon rf if iprog rmp smcup rmcup", FLAG_CAN_TEST); edit_init(); /* initialize the edit data base */ if (send_reset_init && enter_ca_mode) { tc_putp(enter_ca_mode); put_clear(); /* just in case we switched pages */ } put_crlf(); ptext("Using terminfo from: "); ptextln(tty_filename); put_crlf(); if (tty_can_sync == SYNC_NEEDED) { verify_time(); } display_basic(); }
void reset_init(void) { /* send the reset and init strings */ int i; ptext("Terminal reset"); i = char_count; put_name(reset_1string, " (rs1)"); put_name(reset_2string, " (rs2)"); /* run the reset file */ if (reset_file && reset_file[0]) { FILE *fp; int ch; can_test("rf", FLAG_TESTED); if ((fp = fopen(reset_file, "r"))) { /* send the reset file */ sprintf(temp, " (rf) %s", reset_file); ptextln(temp); while (1) { ch = getc(fp); if (ch == EOF) break; put_this(ch); } fclose(fp); } else { sprintf(temp, "\nCannot open reset file (rf) %s", reset_file); ptextln(temp); } } put_name(reset_3string, " (rs3)"); if (i != char_count) { put_crlf(); } ptext(" init"); put_name(init_1string, " (is1)"); put_name(init_2string, " (is2)"); if (set_tab && clear_all_tabs && init_tabs != 8) { put_crlf(); tc_putp(clear_all_tabs); for (char_count = 0; char_count < columns; char_count++) { put_this(' '); if ((char_count & 7) == 7) { tc_putp(set_tab); } } put_cr(); } /* run the initialization file */ if (init_file && init_file[0]) { FILE *fp; int ch; can_test("if", FLAG_TESTED); if ((fp = fopen(init_file, "r"))) { /* send the init file */ sprintf(temp, " (if) %s", init_file); ptextln(temp); while (1) { ch = getc(fp); if (ch == EOF) break; put_this(ch); } fclose(fp); } else { sprintf(temp, "\nCannot open init file (if) %s", init_file); ptextln(temp); } } if (init_prog) { can_test("iprog", FLAG_TESTED); (void) system(init_prog); } put_name(init_3string, " (is3)"); fflush(stdout); }