wget_wch.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1995, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*
* XCurses Library
*
* Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved.
*
*/
#ifdef M_RCSID
#ifndef lint
static char rcsID[] = "$Header: /rd/src/libc/xcurses/rcs/wget_wch.c 1.2 1995/06/08 19:00:47 ant Exp $";
#endif
#endif
#include <private.h>
#include <m_wio.h>
#include <stdlib.h>
/*
* Push a wide character back onto the input queue.
*
* XPG4 is silent as to whether wget_wch() and wgetch()
* can both be used in an applicaton. Assume they can,
* in which case we have to push the multibyte equivalent
* back onto the input queue.
*/
int
{
int i, len;
char mb[MB_LEN_MAX];
#ifdef M_CURSES_TRACE
#endif
for (i = 0; i < len; ++i)
}
int
WINDOW *w;
{
#ifdef M_CURSES_TRACE
#endif
/* Disable echo temporarily, because we're using
* wgetch() to read in individual bytes and only
* want echo the resulting character, not the
* individual bytes composing the character.
*/
oecho = __m_set_echo(0);
/* Input function is wgetch(), which takes a WINDOW * for
* a parameter. The WINDOW * is used to set the "focus" by
* updatng and position the cursor in the relavent window and
* provide window specific settings. Input for all windows
* comes from one stream (__m_screen->_if), which is normally
* the terminal, but can be redirected.
*/
/* Get the first byte or KEY_ value. */
(void) __m_set_echo(oecho);
}
/* Push the byte back onto the input stream so that
* it can be processed by __m_wio_get().
*/
/* Fetch a wide character from a narrow input stream.
* Invalid sequences are preserved as individual bytes.
* Handles insignificant and redundant shifts in the input
* stream.
*/
/* Restore echo. */
(void) __m_set_echo(oecho);
/* Push any invalid multibyte sequence back onto the
* input stack, so that no data is lost, just in case
* the application mixes wide (wget_wch()) and narrow
* (wgetch()) input methods.
*/
/* Now echo wide character if necessary. */
(void) wrefresh(w);
}
}