From: dbrooks@osf.org (David Brooks)
Subject: Re: How to avoid 'setenv LINES XX' ???
Organization: Open Software Foundation
Date: Thu, 21 Jan 1993 17:38:42 GMT

meyer@geomatic.no (Harald Martens Meyer) writes:
| I have a HP9000/720. I recently upgraded to HP-UX 9.0, and find that I
| have to do 'setenv LINES XX' if I try to resize xterm's. (If I don't
| do that, 'more' and 'man' gets confused). I had to do this on HPterms
| on HP-UX8.07, but not on xterm's.
| 
| Is there any way to avoid this. (Preferebly on both HP- and xterm's)

The current X11R5 (pl21) xterm has *two* bugs in it, which prevent it
(a) setting LINES and COLUMNS initially (b) signalling window size
changes.  Seems like whoever built your xterm didn't get those bugs
fixed.

Also, you have to be running a HP standard shell.  Bash, for example,
doesn't DTRT with the window size signal.

Finally, you don't have to setenv directly.  eval `resize` will do it.

Patches to mit/clients/xterm:
*** /tmp/,RCSt1a18628	Thu Jan 21 12:37:13 1993
--- main.c	Tue Nov  3 15:29:22 1992
***************
*** 1,5
  #ifndef lint
! static char *rid="$XConsortium: main.c,v 1.200 92/03/11 17:36:12 gildea Exp $";
  #endif /* lint */
  
  /*

--- 1,5 -----
  #ifndef lint
! static char *rid="$Header: main.c,v 1.202.1.1 92/09/30 09:15:50 dbrooks Exp $";
  #endif /* lint */
  
  /*
***************
*** 172,178
  #include <sys/utsname.h>
  #endif /* hpux */
  
! #ifdef apollo
  #define ttyslot() 1
  #endif /* apollo */
  

--- 172,178 -----
  #include <sys/utsname.h>
  #endif /* hpux */
  
! #if defined(apollo) && OSMAJORVERSION == 10 && OSMINORVERSION < 4
  #define ttyslot() 1
  #endif /* apollo */
  
***************
*** 1056,1061
  		unsigned char *old_bufend;
  
  		old_bufend = (unsigned char *) _bufend(stderr);
  		stderr->_file = i;
  		_bufend(stderr) = old_bufend;
  #else	/* USE_SYSV_TERMIO */

--- 1056,1065 -----
  		unsigned char *old_bufend;
  
  		old_bufend = (unsigned char *) _bufend(stderr);
+ #ifdef hpux
+ 		stderr->__fileH = (i >> 8);
+ 		stderr->__fileL = i;
+ #else
  		stderr->_file = i;
  #endif
  		_bufend(stderr) = old_bufend;
***************
*** 1057,1062
  
  		old_bufend = (unsigned char *) _bufend(stderr);
  		stderr->_file = i;
  		_bufend(stderr) = old_bufend;
  #else	/* USE_SYSV_TERMIO */
  		stderr->_file = i;

--- 1061,1067 -----
  		stderr->__fileL = i;
  #else
  		stderr->_file = i;
+ #endif
  		_bufend(stderr) = old_bufend;
  #else	/* USE_SYSV_TERMIO */
  		stderr->_file = i;
***************
*** 2372,2378
  #endif /* USE_HANDSHAKE */
  
  #ifdef USE_SYSV_ENVVARS
- #ifndef TIOCSWINSZ		/* window size not stored in driver? */
  		sprintf (numbuf, "%d", screen->max_col + 1);
  		Setenv("COLUMNS=", numbuf);
  		sprintf (numbuf, "%d", screen->max_row + 1);

--- 2377,2382 -----
  #endif /* USE_HANDSHAKE */
  
  #ifdef USE_SYSV_ENVVARS
  		sprintf (numbuf, "%d", screen->max_col + 1);
  		Setenv("COLUMNS=", numbuf);
  		sprintf (numbuf, "%d", screen->max_row + 1);
***************
*** 2377,2383
  		Setenv("COLUMNS=", numbuf);
  		sprintf (numbuf, "%d", screen->max_row + 1);
  		Setenv("LINES=", numbuf);
- #endif /* TIOCSWINSZ */
  #ifdef UTMP
  		if (pw) {	/* SVR4 doesn't provide these */
  		    if (!getenv("HOME"))

--- 2381,2386 -----
  		Setenv("COLUMNS=", numbuf);
  		sprintf (numbuf, "%d", screen->max_row + 1);
  		Setenv("LINES=", numbuf);
  #ifdef UTMP
  		if (pw) {	/* SVR4 doesn't provide these */
  		    if (!getenv("HOME"))
*** /tmp/,RCSt1a18638	Thu Jan 21 12:38:13 1993
--- screen.c	Mon Sep 28 16:43:41 1992
***************
*** 1,5
  /*
!  *	$XConsortium: screen.c,v 1.30 91/08/22 16:27:13 gildea Exp $
   */
  
  /*

--- 1,5 -----
  /*
!  *	$Header: screen.c,v 1.30.1.1 92/09/24 12:38:18 dbrooks Exp $
   */
  
  /*
***************
*** 33,39
  
  #include <stdio.h>
  #include <signal.h>
! #ifdef SVR4
  #include <termios.h>
  #else
  #include <sys/ioctl.h>

--- 33,39 -----
  
  #include <stdio.h>
  #include <signal.h>
! #if defined(SVR4) || defined(hpux)
  #include <termios.h>
  #else
  #include <sys/ioctl.h>
-- 
David Brooks					dbrooks@osf.org
Open Software Foundation			uunet!osf.org!dbrooks
Shine out, fair sun, with all your heat!  Black winter freezes to his seat...
The boneless fish close quaking lies...the stars in icicles arise!
Newsgroups: comp.sys.hp