Module Name:    src
Committed By:   roy
Date:           Thu Mar 23 00:36:37 UTC 2017

Modified Files:
        src/lib/libterminfo: setupterm.c term.h

Log Message:
Revert botched commit.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libterminfo/setupterm.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libterminfo/term.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libterminfo/setupterm.c
diff -u src/lib/libterminfo/setupterm.c:1.5 src/lib/libterminfo/setupterm.c:1.6
--- src/lib/libterminfo/setupterm.c:1.5	Thu Mar 23 00:23:29 2017
+++ src/lib/libterminfo/setupterm.c	Thu Mar 23 00:36:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: setupterm.c,v 1.5 2017/03/23 00:23:29 roy Exp $ */
+/* $NetBSD: setupterm.c,v 1.6 2017/03/23 00:36:37 roy Exp $ */
 
 /*
  * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,12 +28,10 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: setupterm.c,v 1.5 2017/03/23 00:23:29 roy Exp $");
+__RCSID("$NetBSD: setupterm.c,v 1.6 2017/03/23 00:36:37 roy Exp $");
 
-#include <sys/ioctl.h>
 #include <assert.h>
 #include <err.h>
-#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <strings.h>
@@ -41,20 +39,6 @@ __RCSID("$NetBSD: setupterm.c,v 1.5 2017
 #include <term_private.h>
 #include <term.h>
 
-/*
- * use_env is really a curses function - POSIX mandates it's in curses.h
- * But it has to live in terminfo because it must precede a call to setupterm().
- */
-#include <curses.h>
-
-static bool __use_env = true;
-
-void
-use_env(bool value)
-{
-
-	__use_env = value;
-}
 #define reterr(code, msg)						      \
 	do {								      \
 		if (errret == NULL)					      \
@@ -80,7 +64,6 @@ int
 ti_setupterm(TERMINAL **nterm, const char *term, int fildes, int *errret)
 {
 	int error;
-	struct winsize win;
 
 	_DIAGASSERT(nterm != NULL);
 
@@ -122,25 +105,6 @@ ti_setupterm(TERMINAL **nterm, const cha
 		reterrarg(0, "%s: generic terminal", term);
 	if (t_hard_copy(*nterm))
 		reterrarg(1, "%s: hardcopy terminal", term);
-
-	/* If TIOCGWINSZ works, then set initial lines and columns. */
-	if (ioctl(fildes, TIOCGWINSZ, &win) != -1 &&
-	    win.ws_row != 0 && win.ws_col != 0)
-	{
-		t_lines(*nterm) = win.ws_row;
-		t_columns(*nterm) = win.ws_col;
-	}
-
-	/* POSIX 1003.2 requires that the environment override. */
-	if (__use_env) {
-		char *p;
-
-		if ((p = getenv("LINES")) != NULL)
-			t_lines(*nterm) = (int)strtol(p, NULL, 0);
-		if ((p = getenv("COLUMNS")) != NULL)
-			t_columns(*nterm) = (int)strtol(p, NULL, 0);
-	}
-
 	/* POSIX requires 1 for success */
 	if (errret)
 		*errret = 1;

Index: src/lib/libterminfo/term.h
diff -u src/lib/libterminfo/term.h:1.20 src/lib/libterminfo/term.h:1.21
--- src/lib/libterminfo/term.h:1.20	Thu Mar 23 00:23:29 2017
+++ src/lib/libterminfo/term.h	Thu Mar 23 00:36:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: term.h,v 1.20 2017/03/23 00:23:29 roy Exp $ */
+/* $NetBSD: term.h,v 1.21 2017/03/23 00:36:37 roy Exp $ */
 
 /*
  * Copyright (c) 2009, 2010, 2011, 2013 The NetBSD Foundation, Inc.
@@ -1933,8 +1933,8 @@ typedef struct {
 	/* We need to expose these so that the macros work */
 	const char *name;
 	const char *desc;
-	signed char *flags;
-	short *nums;
+	const signed char *flags;
+	const short *nums;
 	const char **strs;
 } TERMINAL;
 #endif

Reply via email to