Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!adam.pika.mit.edu!scs From: scs@adam.pika.mit.edu (Steve Summit) Newsgroups: comp.unix.wizards Subject: Re: generating code to run multiple tar Message-ID: <10941@bloom-beacon.MIT.EDU> Date: 29 Apr 89 04:57:51 GMT References: <18927@adm.BRL.MIL> <8800012@gistdev> Sender: daemon@bloom-beacon.MIT.EDU Reply-To: scs@adam.pika.mit.edu (Steve Summit) Lines: 36 In article <8800012@gistdev> flint@gistdev.UUCP correctly points out that: >Getting back what >the machine is is just a kludge way to find out if it has the capability you >are interested in at the time: the same goes for the OS. For example, I don't >really care if I'm running SYSV or BSD4.2, I just want to know if symbolic >links are available. With a bit of creativity, you'll find that many such tests can be performed already, particularly if you can live with compile-time tests. For symbolic links, just #include and then #ifdef S_IFLNK For terminal driver/job control stuff, something like SIGTSTP from often works. Often the predicate for the #ifdef is directly related to what you're about to do: #ifdef SIGWINCH signal(SIGWINCH, resize); #endif If you care about run-time tests (this becomes an issue if you want to move binaries around among various systems which might or might not have the features) you can sometimes get by with judicious return value checking. For example, if your compilation environment supports SIGWINCH but your run environment might not, just ignore an error return from your attempt to catch SIGWINCH (after figuring out what to cast -1 to!) if errno is EINVAL. (Of course, you lose if the target system uses signal 28 for something else.) Steve Summit scs@adam.pika.mit.edu