zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@ny.frontiercomm.net>
To: zsh-workers@math.gatech.edu (Zsh hacking and development)
Subject: More LINES/COLUMNS changes
Date: Sun, 18 May 1997 05:30:30 -0400 (EDT)	[thread overview]
Message-ID: <199705180930.FAA05454@hzoli.home> (raw)

Zsh-3.1.2-test1 and zsh-3.0.3-test5 still does not set LINES correctly on
startup for non-interractive shells.  Non-interactive shells did not trap
SIGWINCH by default.

This patch removes window size check from gettyinfo, traps SIGWINCH for all
shells not just for interactive shells, and calls adjustwinsize() in
update_job() only if MONITOR is set and the shell was detached from the
terminal during the execution of a foreground process.  gettyinfo is called
from update_job() if shout was initialised regardles of the process groups
or the exit value of the job.  It seems that before this patch shttyinfo
was not updated if a process exited with nonzero exit status.  Anyone knows
the reason for that?

The #if defined(__sgi) part from init_shout should probably go to
gettyinfo(), but I do not what it does, so I did not move it.

This patch applies to unchanged zsh-3.1.2-test1 or zsh-3.0.3-test5.  If you
applied my previous patch to jobs.c, remove it before applying this patch.

Zoltan


*** Src/init.c	1997/05/11 05:01:43	3.1.2.10
--- Src/init.c	1997/05/18 08:06:41
***************
*** 519,526 ****
      createparamtable();     /* create paramater hash table             */
  
  #ifdef TIOCGWINSZ
!     setiparam("COLUMNS", shttyinfo.winsize.ws_col);
!     setiparam("LINES", shttyinfo.winsize.ws_row);
  #else
      /* Using zero below sets the defaults from termcap */
      setiparam("COLUMNS", 0);
--- 519,525 ----
      createparamtable();     /* create paramater hash table             */
  
  #ifdef TIOCGWINSZ
!     adjustwinsize();
  #else
      /* Using zero below sets the defaults from termcap */
      setiparam("COLUMNS", 0);
***************
*** 571,581 ****
  
      install_handler(SIGHUP);
      install_handler(SIGCHLD);
-     if (interact) {
- 	install_handler(SIGALRM);
  #ifdef SIGWINCH
! 	install_handler(SIGWINCH);
  #endif
  	signal_ignore(SIGTERM);
      }
      if (jobbing) {
--- 570,580 ----
  
      install_handler(SIGHUP);
      install_handler(SIGCHLD);
  #ifdef SIGWINCH
!     install_handler(SIGWINCH);
  #endif
+     if (interact) {
+ 	install_handler(SIGALRM);
  	signal_ignore(SIGTERM);
      }
      if (jobbing) {
***************
*** 685,691 ****
  
      if (interact && isset(RCS))
  	readhistfile(getsparam("HISTFILE"), 0);
-     adjustwinsize();   /* check window size and adjust if necessary */
  }
  
  /* source a file */
--- 684,689 ----
*** Src/utils.c	1997/05/09 07:59:00	3.1.2.12
--- Src/utils.c	1997/05/18 07:53:10
***************
*** 752,762 ****
  	ioctl(SHTTY, TIOCGLTC, &ti->ltchars);
  # endif
  #endif
- #ifdef TIOCGWINSZ
- /*	if (ioctl(SHTTY, TIOCGWINSZ, &ti->winsize) == -1)
- 	    	zerr("bad tiocgwinsz: %e",NULL,errno);*/
- 	ioctl(SHTTY, TIOCGWINSZ, (char *)&ti->winsize);
- #endif
      }
  }
  
--- 752,757 ----
*** Src/jobs.c	1997/05/09 04:55:51	3.1.2.3
--- Src/jobs.c	1997/05/18 08:37:32
***************
*** 120,126 ****
      int job;
      int val = 0, status = 0;
      int somestopped = 0, inforeground = 0;
-     pid_t pgrp;
  
      for (pn = jn->procs; pn; pn = pn->next) {
  	if (pn->status == SP_RUNNING)      /* some processes in this job are running       */
--- 120,125 ----
***************
*** 154,166 ****
  	}
      }
  
!     pgrp = gettygrp();           /* get process group of tty      */
! 
!     /* is this job in the foreground of an interactive shell? */
!     if ((jn->gleader == pgrp || (pgrp > 1 && kill(-pgrp, 0) == -1)) &&
! 	!ttyfrozen && !val && !jn->stty_in_env)
  	gettyinfo(&shttyinfo);
!     adjustwinsize();             /* check window size and adjust if necessary */
      if (somestopped && jn->stat & STAT_SUPERJOB)
  	return;
      jn->stat |= (somestopped) ? STAT_CHANGED | STAT_STOPPED :
--- 153,172 ----
  	}
      }
  
!     if (shout && !ttyfrozen && !jn->stty_in_env)
  	gettyinfo(&shttyinfo);
! 
!     if (isset(MONITOR)) {
! 	pid_t pgrp = gettygrp();           /* get process group of tty      */
! 
! 	/* is this job in the foreground of an interactive shell? */
! 	if (mypgrp != pgrp && (jn->gleader == pgrp ||
! 			       (pgrp > 1 && kill(-pgrp, 0) == -1))) {
! 	    attachtty(mypgrp);
! 	    adjustwinsize();   /* check window size and adjust if necessary */
! 	}
!     }
! 
      if (somestopped && jn->stat & STAT_SUPERJOB)
  	return;
      jn->stat |= (somestopped) ? STAT_CHANGED | STAT_STOPPED :


                 reply	other threads:[~1997-05-18  9:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199705180930.FAA05454@hzoli.home \
    --to=hzoli@ny.frontiercomm.net \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).