Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!mintaka!bloom-picayune.mit.edu!news From: scs@adam.mit.edu (Steve Summit) Newsgroups: comp.unix.programmer Subject: Re: winsize struct Message-ID: <1991Feb13.032238.11640@athena.mit.edu> Date: 13 Feb 91 03:22:38 GMT References: <1991Feb11.192013.6587@mccc.edu> <1991Feb12.211450.28938@athena.mit.edu> Sender: news@athena.mit.edu (News system) Reply-To: scs@adam.mit.edu Organization: Thermal Technologies, Inc. Lines: 37 In article <1991Feb12.211450.28938@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: >...if you're using a system that doesn't define the winsize structure >in any of its header files, the most likely explanation is that the system >doesn't *support* the SIGWINCH signal or the TIOCGWINSZ/TIOCSWINSZ ioctl's... >The programs should be written in such a way... to disable the... winsize >stuff... using preprocessor symbols to determine whether the system on which >they are being compiled has winsize. Furthermore, this is one happy case in which you *don't* have to invent your own preprocessor symbols. (Jon probably understands this, but I want to make the notion explicit.) The code in question can be made conditional on #ifdef SIGWINCH and/or #ifdef TIOCSWINSZ No Makefile editing, no config scripts, no multiplicity-of- features-lumped-under-one-OS-specific-macro. (Of course, figuring out what to #include may be tricky, but here it really ought to be and , respectively.) With a bit of creativity, you can use tricks like these for a number of other OS-dependent features. For example, make your symbolic link support conditional on S_IFLNK, after #including . (If you try to make symbolic link code conditional on something like BSD4, you make life difficult for people trying to compile the code on a non-BSD system which does have symbolic links but which otherwise isn't much like BSD.) Don't put the code for catching SIGTSTP inside #ifdef JOBCONTROL; put it inside #ifdef SIGTSTP. Settable line disciplines? TIOCSETD. Etc. Steve Summit scs@adam.mit.edu