Beispiel #1
0
static void
line_pattern(void)
{				/* put up a pattern that will help count the
				   number of lines */
    int i;

    put_clear();
    if (over_strike) {
	for (i = 0; i < 100; i++) {
	    int j;

	    if (i) {
		put_crlf();
	    }
	    for (j = i / 10; j; j--) {
		put_this(' ');
	    }
	    put_this('0' + ((i + 1) % 10));
	}
    } else {			/* I assume it will scroll */
	for (i = 100; i; i--) {
	    sprintf(temp, "\r\n%d", i);
	    put_str(temp);
	}
    }
}
Beispiel #2
0
static void
column_pattern(void)
{				/* put up a pattern that will help count the
				   number of columns */
    int i, j;

    put_clear();
    for (i = 0; i < 20; i++) {
	for (j = 1; j < 10; j++) {
	    put_this('0' + j);
	}
	put_this('.');
    }
}
Beispiel #3
0
/*
**	sync_home(test_list, status, ch)
**
**	Baudrate test
*/
void
sync_home(
	struct test_list *t,
	int *state,
	int *ch)
{
	int j, k;
	unsigned long rate;

	if (!cursor_home && !cursor_address && !row_address) {
		ptext("Terminal can not home cursor.  ");
		generic_done_message(t, state, ch);
		return;
	}
	if (skip_pad_test(t, state, ch,
		"(home) Start baudrate search")) {
		return;
	}
	pad_test_startup(1);
	do {
		go_home();
		for (j = 1; j < lines; j++) {
			for (k = 0; k < columns; k++) {
				if (k & 0xF) {
					put_this(letter);
				} else {
					put_this('.');
				}
			}
			SLOW_TERMINAL_EXIT;
		}
		NEXT_LETTER;
	} while(still_testing());
	pad_test_shutdown(t, auto_right_margin == 0);
	/* note:  tty_frame_size is the real framesize times two.
	   This takes care of half bits. */
	rate = (tx_cps * tty_frame_size) >> 1;
	if (rate > tty_baud_rate) {
		tty_baud_rate = rate;
	}
	if (tx_cps > tty_cps) {
		tty_cps = tx_cps;
	}
	sprintf(temp, "%d characters per second.  Baudrate %d  ", tx_cps, j);
	ptext(temp);
	generic_done_message(t, state, ch);
}
Beispiel #4
0
/*
**	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);
}
Beispiel #5
0
/*
**	subtest_rmam(test_list, status, ch)
**
**	test exit automatic margins mode (rmam)
*/
static void
subtest_rmam(
	struct test_list *t,
	int *state,
	int *ch)
{
	int j;

	if (!exit_am_mode) {
		ptext("(rmam) not present.  ");
	} else
	if (!can_go_home) {
		ptext("(rmam) not tested, no way to home cursor.  ");
	} else
	if (over_strike) {
		put_clear();
		go_home();
		tc_putp(exit_am_mode);
		ptext("\n(rmam) will     reset (am)");
		go_home();
		for (j = 0; j < columns; j++)
			put_this(' ');
		ptext("(rmam) will not reset (am)");
		go_home();
		put_newlines(2);
	} else {
		put_clear();
		go_home();
		tc_putp(exit_am_mode);
		ptext("\n(rmam) will reset (am)");
		go_home();
		for (j = 0; j < columns; j++)
			put_this(' ');
		ptext("(rmam) will not reset (am) ");
		go_home();
		put_str("                          ");
		go_home();
		put_newlines(2);
	}
	ptext("Exit-automatic-margins ");
	generic_done_message(t, state, ch);
}
Beispiel #6
0
/*
**	subtest_smam(test_list, status, ch)
**
**	test enter automatic margins mode (smam)
*/
static void
subtest_smam(
	struct test_list *t,
	int *state,
	int *ch)
{
	int i, j;

	if (!enter_am_mode) {
		ptext("(smam) not present.  ");
	} else
	if (!can_go_home) {
		ptext("(smam) not tested, no way to home cursor.  ");
	} else
	if (over_strike) {
		put_clear();
		go_home();
		tc_putp(enter_am_mode);
		ptext("\n(smam) will ");
		i = char_count;
		ptext("not set (am)");
		go_home();
		for (j = -i; j < columns; j++)
			put_this(' ');
		put_str("@@@");
		put_newlines(2);
	} else {
		put_clear();
		go_home();
		tc_putp(enter_am_mode);
		ptext("\n(smam) will not set (am)");
		go_home();
		for (j = 0; j < columns; j++)
			put_this(' ');
		ptext("(smam) will set (am)    ");
		go_home();
		put_str("                          ");
		put_newlines(2);
	}
	ptext("Enter-automatic-margins ");
	generic_done_message(t, state, ch);
}
Beispiel #7
0
/*
**	putchp(character)
**
**	Send one character to the terminal.
**	This function does translation of control characters.
*/
void
putchp(int c)
{
	switch (c) {
	case '\b':
		if (translate_mode && cursor_left) {
			tt_putp(cursor_left);
		} else {
			tt_putp(TM_cursor_left);
		}
		char_count--;
		break;
	case 7:
		if (translate_mode && bell) {
			tt_putp(bell);
		} else {
			tt_putp(TM_bell);
		}
		break;
	case '\f':
		if (translate_mode && form_feed) {
			tt_putp(form_feed);
		} else {
			tt_putp(TM_form_feed);
		}
		char_count = 0;
		line_count++;
		break;
	case '\n':
		put_crlf();
		break;
	case '\r':
		put_cr();
		break;
	case '\t':
		if (translate_mode && tab) {
			tt_putp(tab);
		} else {
			tt_putp(TM_tab);
		}
		char_count = ((char_count / 8) + 1) * 8;
		break;
	default:
		put_this(c);
		char_count++;
		break;
	}
}
Beispiel #8
0
/*
**	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);
}
Beispiel #9
0
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);
}