X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Flib_initscr.c;h=e33f0b345de7f1713ed8464c3acae80cb1268e0f;hp=3a995d22f662fcb2c3011a9e8c0d5220f69c5087;hb=661078ddbde3ce0f3b06e95642fbb9b5fef7dca1;hpb=3a9b6a3bf0269231bef7de74757a910dedd04e0c diff --git a/ncurses/lib_initscr.c b/ncurses/lib_initscr.c index 3a995d22..e33f0b34 100644 --- a/ncurses/lib_initscr.c +++ b/ncurses/lib_initscr.c @@ -1,23 +1,35 @@ - -/*************************************************************************** -* COPYRIGHT NOTICE * -**************************************************************************** -* ncurses is copyright (C) 1992-1995 * -* Zeyd M. Ben-Halim * -* zmbenhal@netcom.com * -* Eric S. Raymond * -* esr@snark.thyrsus.com * -* * -* Permission is hereby granted to reproduce and distribute ncurses * -* by any means and for any fee, whether alone or as part of a * -* larger distribution, in source or in binary form, PROVIDED * -* this notice is included with any such distribution, and is not * -* removed from any of its header files. Mention of ncurses in any * -* applications linked with it is highly appreciated. * -* * -* ncurses comes AS IS with no warranty, implied or expressed. * -* * -***************************************************************************/ +/**************************************************************************** + * Copyright (c) 1998 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim 1992,1995 * + * and: Eric S. Raymond * + ****************************************************************************/ /* ** lib_initscr.c @@ -27,42 +39,13 @@ */ #include -#include /* cur_term */ +#include /* for MAX_ALIAS */ #if HAVE_SYS_TERMIO_H #include /* needed for ISC */ #endif -MODULE_ID("$Id: lib_initscr.c,v 1.18 1997/03/08 14:03:59 tom Exp $") - -#ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ -#define ONLCR 0 -#endif - -/* - * SVr4/XSI Curses specify that hardware echo is turned off in initscr, and not - * restored during the curses session. The library simulates echo in software. - * (The behavior is unspecified if the application enables hardware echo). - * - * The newterm function also initializes terminal settings. - */ -int _nc_initscr(void) -{ - /* for extended XPG4 conformance requires cbreak() at this point */ - /* (SVr4 curses does this anyway) */ - cbreak(); - -#ifdef TERMIOS - cur_term->Nttyb.c_lflag &= ~(ECHO|ECHONL); - cur_term->Nttyb.c_iflag &= ~(ICRNL|INLCR|IGNCR); - cur_term->Nttyb.c_oflag &= ~(ONLCR); -#else - cur_term->Nttyb.sg_flags &= ~(ECHO|CRMOD); -#endif - if ((SET_TTY(cur_term->Filedes, &cur_term->Nttyb)) == -1) - return ERR; - return OK; -} +MODULE_ID("$Id: lib_initscr.c,v 1.21 1998/02/11 12:14:00 tom Exp $") WINDOW *initscr(void) { @@ -74,7 +57,8 @@ const char *name; if (!initialized) { initialized = TRUE; - if ((name = getenv("TERM")) == 0) + if ((name = getenv("TERM")) == 0 + || *name == '\0') name = "unknown"; if (newterm(name, stdout, stdin) == 0) { fprintf(stderr, "Error opening terminal: %s.\n", name); @@ -94,7 +78,7 @@ const char *name; char *termname(void) { char *term = getenv("TERM"); -static char ret[15]; +static char ret[MAX_ALIAS]; T(("termname() called"));