- if (setupterm(name, fileno(ofp), &errret) == ERR)
- return 0;
-
- /* implement filter mode */
- if (filter_mode) {
- LINES = 1;
-
- if (VALID_NUMERIC(init_tabs))
- TABSIZE = init_tabs;
- else
- TABSIZE = 8;
-
- T(("TABSIZE = %d", TABSIZE));
-
- clear_screen = 0;
- cursor_down = parm_down_cursor = 0;
- cursor_address = 0;
- cursor_up = parm_up_cursor = 0;
- row_address = 0;
-
- cursor_home = carriage_return;
- }
-
- /* If we must simulate soft labels, grab off the line to be used.
- We assume that we must simulate, if it is none of the standard
- formats (4-4 or 3-2-3) for which there may be some hardware
- support. */
- if (num_labels <= 0 || !SLK_STDFMT(slk_format))
- if (slk_format) {
- if (ERR == _nc_ripoffline(-SLK_LINES(slk_format),
- _nc_slk_initialize))
- return 0;
+ if (setupterm(name, fileno(ofp), &errret) == ERR) {
+ result = 0;
+ } else {
+ /*
+ * This actually allocates the screen structure, and saves the original
+ * terminal settings.
+ */
+ current = SP;
+ _nc_set_screen(0);
+
+ /* allow user to set maximum escape delay from the environment */
+ if ((value = _nc_getenv_num("ESCDELAY")) >= 0) {
+#if USE_REENTRANT
+ SP->_ESCDELAY = value;
+#else
+ ESCDELAY = value;
+#endif