Files
Arquivotheca.Solaris-2.5/lib/libcurses/screen/ungetch.c
seta75D 7c4988eac0 Init
2021-10-11 19:38:01 -03:00

43 lines
1009 B
C
Executable File

/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ident "@(#)ungetch.c 1.6 93/05/05 SMI" /* SVr4.0 1.4 */
#include "curses_inc.h"
/* Place a char onto the beginning of the input queue. */
ungetch(ch)
int ch;
{
register int i = cur_term->_chars_on_queue, j = i - 1;
register chtype *inputQ = cur_term->_input_queue;
/* Place the character at the beg of the Q */
/*
Here is commented out because 'ch' should deal with a single byte
character only. So ISCBIT(ch) is 0 every time.
register chtype r;
if(ISCBIT(ch))
{
r = RBYTE(ch);
ch = LBYTE(ch);
-* do the right half first to maintain the byte order *-
if(r != MBIT && ungetch(r) == ERR)
return ERR;
}
*/
while (i > 0)
inputQ[i--] = inputQ[j--];
cur_term->_ungotten++;
inputQ[0] = -ch;
cur_term->_chars_on_queue++;
}