8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / ucblib / libcurses / initscr.c
blob609205c98fe1c41dc758548cc0c27f962860d8b2
1 /*
2 * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
4 */
6 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
7 /* All Rights Reserved */
9 /*
10 * Copyright (c) 1980 Regents of the University of California.
11 * All rights reserved. The Berkeley software License Agreement
12 * specifies the terms and conditions for redistribution.
15 #pragma ident "%Z%%M% %I% %E% SMI"
17 /*LINTLIBRARY*/
19 #ifndef lint
20 static char
21 sccsid[] = "@(#)initscr.c 1.6 88/02/08 SMI"; /* from UCB 5.1 85/06/07 */
22 #endif /* not lint */
24 #include "curses.ext"
25 #include <term.h>
26 #include <stdlib.h>
27 #include <signal.h>
30 * This routine initializes the current and standard screen.
33 WINDOW *
34 initscr(void)
36 char *sp;
38 #ifdef DEBUG
39 fprintf(outf, "INITSCR()\n");
40 #endif
41 if (My_term)
42 (void) setterm(Def_term);
43 else {
44 (void) gettmode();
45 if ((sp = getenv("TERM")) == NULL)
46 sp = Def_term;
47 (void) setterm(sp);
48 #ifdef DEBUG
49 fprintf(outf, "INITSCR: term = %s\n", sp);
50 #endif
52 (void) _puts(TI);
53 (void) _puts(VS);
54 #ifdef SIGTSTP
55 (void) signal(SIGTSTP, (void(*)(int))tstp);
56 #endif
57 if (curscr != NULL) {
58 #ifdef DEBUG
59 fprintf(outf, "INITSCR: curscr = 0%o\n", curscr);
60 #endif
61 (void) delwin(curscr);
63 #ifdef DEBUG
64 fprintf(outf, "LINES = %d, COLS = %d\n", LINES, COLS);
65 #endif
66 if ((curscr = newwin(LINES, COLS, 0, 0)) == ERR)
67 return (ERR);
68 clearok(curscr, TRUE);
69 curscr->_flags &= ~_FULLLINE;
70 if (stdscr != NULL) {
71 #ifdef DEBUG
72 fprintf(outf, "INITSCR: stdscr = 0%o\n", stdscr);
73 #endif
74 (void) delwin(stdscr);
76 stdscr = newwin(LINES, COLS, 0, 0);
77 return (stdscr);