generating code to run multiple tar
Steve Summit
scs at adam.pika.mit.edu
Sat Apr 29 14:57:51 AEST 1989
In article <8800012 at gistdev> flint at 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
<sys/stat.h> and then
#ifdef S_IFLNK
For terminal driver/job control stuff, something like SIGTSTP
from <signal.h> 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 at adam.pika.mit.edu
More information about the Comp.unix.wizards
mailing list