Пример #1
0
    main ()	/* test case */

    {
    struct ECB ecb;
    COUNT lines, columns;
    CODE type, term, code;
    TEXT string[STRINGSIZ+1];
    TEXT	*str;

    t_init(&lines, &columns, &type);
    t_clear();
    printf("lines, columns, type = %d, %d, %d\n",
	   lines, columns, type);
    t_output(10, 30, "line 10, column 30");
    t_write("\nnon-CRT write to next line\n", T_STDCC);
    t_input(20, 10, string, &term);
    printf("Terminator = %s\n",  (term == T_CR) ? "(return)" : "(escape)");
    t_highlight (string);
    t_output(22, 10, string);	/* echo */
    t_lclear (22, 15);		/* clear original except 5 character */
    t_write ("hit left, right, up, down, GOLD, or any key");
    code = t_gettok ();
    if (code == T_LEFT) str = "LEFT";
    else if (code == T_RIGHT) str = "RIGHT";
    else if (code == T_UP) str = "UP";
    else if (code == T_DOWN) str = "DOWN";
    else if (code == T_GOLD) str = "GOLD";
    else if (code == T_UNKNOWN) str = "UNKNOWN";
    else 
        {
        string[0] = code;
        string[1] = EOS;
        str = string;
        }    
    t_write (str, T_STDCC);	
    for (;;)
	{
	t_bell();		/* bell every time controlc hit */
        t_write(" ", T_STDCC);	/* flush			*/
        t_attn(&ecb);
	while (!e_occur(&ecb))  /* loop till event		*/
	    ;
	}    
    exit ();
    }
Пример #2
0
int
ti_puts(const TERMINAL *term, const char *str, int affcnt,
    int (*outc)(int, void *), void *args)
{
	int dodelay;
	char pc;

	_DIAGASSERT(term != NULL);
	_DIAGASSERT(str != NULL);
	_DIAGASSERT(outc != NULL);
	
	dodelay = (str == t_bell(term) ||
	    str == t_flash_screen(term) ||
	    (t_xon_xoff(term) == 0 && t_padding_baud_rate(term) != 0));

	if (t_pad_char(term) == NULL)
	    pc = '\0';
	else
	    pc = *t_pad_char(term);
	return _ti_puts(dodelay, term->_ospeed, pc,
	    str, affcnt, outc, args);
}