- /*
- * Finally, look for environment variables.
- *
- * Solaris lets users override either dimension with an environment
- * variable.
- */
- if ((value = _nc_getenv_num("LINES")) > 0) {
- *linep = value;
- T(("screen size: environment LINES = %d", *linep));
- }
- if ((value = _nc_getenv_num("COLUMNS")) > 0) {
- *colp = value;
- T(("screen size: environment COLUMNS = %d", *colp));
+ if (useEnv) {
+ int value;
+
+ if (useTioctl) {
+ /*
+ * If environment variables are used, update them.
+ */
+ if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
+ _nc_setenv_num("LINES", *linep);
+ }
+ if (_nc_getenv_num("COLUMNS") > 0) {
+ _nc_setenv_num("COLUMNS", *colp);
+ }
+ }
+
+ /*
+ * Finally, look for environment variables.
+ *
+ * Solaris lets users override either dimension with an environment
+ * variable.
+ */
+ if ((value = _nc_getenv_num("LINES")) > 0) {
+ *linep = value;
+ T(("screen size: environment LINES = %d", *linep));
+ }
+ if ((value = _nc_getenv_num("COLUMNS")) > 0) {
+ *colp = value;
+ T(("screen size: environment COLUMNS = %d", *colp));
+ }