On 19/09/05, Otto Moerbeek <[EMAIL PROTECTED]> wrote: > On Mon, 19 Sep 2005, Andreas Kahari wrote: > > On 19/09/05, Damien Miller <[EMAIL PROTECTED]> wrote: > > > Andreas Kahari wrote: > > > > (the WINCH signal is delivered when the terminal window changes size) > > > > > > SIGWINCH is ignored by default, otherwise your sleep(1) would exit if > > > you changed the size of your xterm. See signal(3) for the full list. > > > > Ok, so sleep(1) is explicitly ignoring the signal. Can I get it be > > interrupted by the signal instead? No, maybe that won't solve my > > problem because the installed handler ('eval $(resize)') wouldn't be > > run, I guess. > > If a program handles SIGWINCH both the shell trap handler and the > program's handler will get called. > > #!/bin/ksh > > trap 'eval echo hi from sh' WINCH > > while true; do > ./a.out > echo done sleeping $? > done > > #include <signal.h> > #include <stdio.h> > #include <unistd.h> > > void hi(int a) > { > char p[] = "hi from program\n"; > write(0, p, sizeof(p) - 1); > } > > int > main() > { > signal(SIGWINCH, hi); > return sleep(10); > } > > If you run the shell script en resize the window, you'll see: > > hi from program > hi from sh > done sleeping 4
This is most helpful. I think I understand how this works now. Thanks a lot. Andreas -- Andreas Kahari