/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2002,2006 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 *
/****************************************************************************
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ * and: Thomas E. Dickey 1996-on *
****************************************************************************/
/*
#include <curses.priv.h>
-#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
+#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
#endif
-#include <term.h> /* lines, columns, cur_term */
+#include <term.h> /* lines, columns, cur_term */
-MODULE_ID("$Id: lib_restart.c,v 1.2 1999/07/24 20:10:04 tom Exp $")
+MODULE_ID("$Id: lib_restart.c,v 1.6 2006/01/14 15:58:23 tom Exp $")
-int restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
+NCURSES_EXPORT(int)
+restartterm(NCURSES_CONST char *termp, int filenum, int *errret)
{
-int saveecho = SP->_echo;
-int savecbreak = SP->_cbreak;
-int saveraw = SP->_raw;
-int savenl = SP->_nl;
+ int saveecho = SP->_echo;
+ int savecbreak = SP->_cbreak;
+ int saveraw = SP->_raw;
+ int savenl = SP->_nl;
+ int result;
- T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
+ T((T_CALLED("restartterm(%s,%d,%p)"), termp, filenum, errret));
- setupterm(termp, filenum, errret);
+ _nc_handle_sigwinch(0);
+ if (setupterm(termp, filenum, errret) != OK) {
+ result = ERR;
+ } else {
if (saveecho)
- echo();
+ echo();
else
- noecho();
+ noecho();
if (savecbreak) {
- cbreak();
- noraw();
+ cbreak();
+ noraw();
} else if (saveraw) {
- nocbreak();
- raw();
+ nocbreak();
+ raw();
} else {
- nocbreak();
- noraw();
+ nocbreak();
+ noraw();
}
if (savenl)
- nl();
+ nl();
else
- nonl();
+ nonl();
reset_prog_mode();
_nc_update_screensize();
#endif
- returnCode(OK);
+ result = OK;
+ }
+ _nc_handle_sigwinch(1);
+ returnCode(result);
}