2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * Copyright 1990, 1995 by Mortice Kern Systems Inc. All rights reserved. 2N/A * Non-canonical mode ... 2N/A * Don't care about full lines ... continue 2N/A * Terminal subsystem worries about lines etc. ... 2N/A /* We turned off ICANON so we have to do it ourselves */ 2N/A /* We set delay mode. Only error if noting in the read */ 2N/A/* Assumes count > 0 */ 2N/A/* Discard n characters from front of Q */ 2N/A /* If halfdelay mode. Leave canonical mode intact */ 2N/A /* If blocking mode. Leave canonical mode intact */ 2N/A /* VMIN and VTIME trash VEOL and VEOF so canonical cannot work */ 2N/A /* save actual setting for later test */ 2N/A /* save actual setting for later test */ 2N/A }
else if (r == 0) {
2N/A /* Typeahead disabled */ 2N/A /* if in wgetch, always do refresh */ 2N/A * Push single-byte character back onto the input queue. 2N/A * MKS EXTENSION permits the return value of wgetch(), which 2N/A * can be a KEY_ value, to be pushed back. 2N/A * Return true if the SCREEN's stream has an I/O error. 2N/A * Ignore the window parameter. 2N/A * Return true if the SCREEN's stream has seen EOF. 2N/A * Ignore the window parameter. 2N/A * Clear the error and eof flags of the SCREEN's stream. 2N/A * Ignore the window parameter. 2N/A /* Put EOF on Q only in non-canonical mode */ 2N/A * Only check for function keys if keypad is true and we 2N/A * did not read a KEY_ value (which are < 0), nor EOF. 2N/A * It is conceivable that a KEY_ was pushed back with 2N/A * Treat the termios ERASE key the same as key_backspace. 2N/A * We used to change the key_backspace entry to be a string 2N/A * containing the ERASE key in setupterm(), but this would 2N/A * then disable the real terminfo entry for the backspace key. 2N/A * of the backspace key in application keypad mode. 2N/A * Refer to _shell instead of _prog, since _shell will 2N/A * correctly reflect the user's prefered settings, whereas 2N/A * _prog may not have been initialised if both input and 2N/A * output have been redirected. 2N/A /* Discard ch from Q */ 2N/A /* Begin check for function key. */ 2N/A /* Use input stack as a queue. */ 2N/A for (i =
1; ; i++) {
2N/A /* Found funuction key? */ 2N/A /* Trash all input used to make the FKey */ 2N/A * Get next candidate character - 2N/A * either from Q or input 2N/A * Setup interbyte timer (once only). 2N/A * fgetc() will return EOF if no input received, 2N/A * which may not be a true EOF. 2N/A /* Timeout or real eof. */ 2N/A /* Incomplete sequence, continue. */ 2N/A /* Return first byte received or EOF. */