home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / programm / 5827 < prev    next >
Encoding:
Internet Message Format  |  1993-01-05  |  3.0 KB

  1. Path: sparky!uunet!math.fu-berlin.de!mailgzrz.TU-Berlin.DE!news.netmbx.de!Germany.EU.net!urmel.informatik.rwth-aachen.de!gandalf!michael
  2. From: michael@gandalf.moria (Michael Haardt)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Re: how does term[cap,lib] work
  5. Date: Mon, 04 Jan 93 23:18:13 +0100
  6. Organization: An old and gray machine, somewhere in Moria.
  7. Lines: 54
  8. Distribution: world
  9. Message-ID: <9301043449@gandalf.moria>
  10. References: <1993Jan3.201913.18477@umr.edu>
  11. Reply-To: u31b3hs@pool.informatik.rwth-aachen.de (Michael Haardt)
  12. NNTP-Posting-Host: messua.informatik.rwth-aachen.de
  13.  
  14. In article <1993Jan3.201913.18477@umr.edu>, mcastle@cs.umr.edu (Michael R Castle) writes:
  15. > However, I'm a little unsure what to expect with programs that use
  16. > termcap/lib.  It appears to me that the termcap functions return
  17. > string of escape sequence that would then be printed out rather
  18. > than executing the sequences themselves.  Is this a correct 
  19. > interpretations?
  20.  
  21. Yes.  I should add, that they are printed using tputs() and nothing
  22. else.
  23.  
  24. >                   If it it, it looks like I may have a bit more
  25. > to look foward to than I had originally planned.  :-/
  26.  
  27. My way out once was to write termcap functions which return tokens in
  28. the strings.  tputs looks like "switch (*token) { case CH: ... case CM: }"
  29. Note that you have to encode parameters in the string too, but all in
  30. all it is not hard to code.
  31.  
  32. > Along the same lines.  How does the SIGWINCH signal get propogated
  33. > along?  
  34.  
  35. I am not really sure about that, so the following explanations may be
  36. wrong:  The process running with a pty slave as controlling tty gets
  37. SIGWINCH when the master side sets the winsize structure using ioctl().
  38.  
  39. > Example:  I start up an xterm and resize it.  Does a program that
  40. > catch it then change it's TERMCAP environment variable to update
  41. > the new change?
  42.  
  43. The usual reaction to SIGWINCH is either to reread co/li from termcap or
  44. get the winsize using ioctl().  Some termcap libraries read co/li not
  45. from /etc/termcap but from the winsize struct (if it contains valid
  46. values).  Changing $TERMCAP might help the next program, but you can't
  47. change the environment of another already running process.
  48.  
  49. >                  Also, how does stty figure into all this (does
  50. > stty send a SIGWINCH?)  I notice if I do this, some programs,
  51. > like more(1) and vi(1) do the right thing.  Are they catching
  52. > the signal, or checking the current tty information constantly?
  53.  
  54. stty does an ioctl() to change winsize.
  55.  
  56. > This last may cause problems because it's so easy under dos for a 
  57. > program to change it's own window size and I'm curious as to how
  58. > programs handle this.
  59.  
  60. My explainations are only valid (if at all) for systems which pass the
  61. winsize struct from master through kernel to slave side.  If a system
  62. doesn't, you have no other way to find out the window size than to ask
  63. the window environment about it.  At least I got told that concerning
  64. HP-UX, where a not-yet-famous editor asks xterm for the new size after
  65. getting SIGWINCH.
  66.  
  67. Michael "doesn't like ptys and winsize structs"
  68.