Exemple #1
0
void
put_cr(void)
{
	if (translate_mode && carriage_return) {
		tt_putp(carriage_return);
	} else {
		tt_putp(TM_carriage_return);
	}
	char_count = 0;
}
Exemple #2
0
/*
**	put_crlf()
**
**	Send (nel)  or <cr> <lf>
*/
void
put_crlf(void)
{
	if (translate_mode && newline) {
		tt_putp(newline);
	} else {
		tt_putp(TM_newline);
	}
	char_count = 0;
	line_count++;
}
Exemple #3
0
void
put_ind(void)
{				/* scroll forward (only works in RAW or
				   CBREAK mode) */
	if (translate_mode && scroll_forward) {
		tt_putp(scroll_forward);
	} else {
		tt_putp(TM_scroll_forward);
	}
	line_count++;
}
Exemple #4
0
void
put_lf(void)
{				/* send a linefeed (only works in RAW or
				   CBREAK mode) */
	if (translate_mode && cursor_down) {
		tt_putp(cursor_down);
	} else {
		tt_putp(TM_cursor_down);
	}
	line_count++;
}
Exemple #5
0
void
put_this(int c)
{				/* output one character (with padding) */
	tc_putch(c);
	if (char_padding && replace_mode)
		tt_putp(char_padding);
}
Exemple #6
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;
	}
}
Exemple #7
0
/*
**	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);
}
Exemple #8
0
int
tty_sync_error(void)
{
	int ch, trouble, ack;

	trouble = FALSE;
	for (;;) {
		tt_putp(tty_ENQ);	/* send ENQ */
		ch = getnext(STRIP_PARITY);
		event_start(TIME_SYNC);	/* start the timer */

		/*
		   The timer doesn't start until we get the first character.
		   After that I expect to get the remaining characters of
		   the acknowledge string in a short period of time.  If
		   that is not true then these characters are coming from
		   the user and we need to send the ENQ sequence out again.
		*/
		for (ack = 0; ; ) {
			if (ack < TTY_ACK_SIZE - 2) {
				tty_ACK[ack] = ch;
				tty_ACK[ack + 1] = '\0';
			}
			if (ch == ACK_terminator) {
				return trouble;
			}
			if (++ack >= ACK_length) {
				return trouble;
			}
			ch = getnext(STRIP_PARITY);
			if (event_time(TIME_SYNC) > 400000) {
				break;
			}
		}

		set_attr(0);	/* just in case */
		put_crlf();
		if (trouble) {
			/* The terminal won't sync.  Life is not good. */
			return TRUE;
		}
		put_str(" -- sync -- ");
		trouble = TRUE;
	}
}