Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
More LINES/COLUMNS changes
- X-seq: zsh-workers 3156
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hacking and development)
- Subject: More LINES/COLUMNS changes
- Date: Sun, 18 May 1997 05:30:30 -0400 (EDT)
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 :
Messages sorted by:
Reverse Date,
Date,
Thread,
Author