Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!edsews!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Determining system type Message-ID: <1120@auspex.UUCP> Date: 6 Mar 89 02:20:33 GMT References: <327@wubios.wustl.edu> <15406@cup.portal.com> Reply-To: guy@auspex.UUCP (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 41 >Is there a "standard" -- or optimal -- way to determine at compile time >whether one is on a BSD or AT&T (Ver7, SysIII, SysV) system? No. I suspect you're really not interested in whether you're on a "BSD" or "AT&T" system; you're probably *really* interested in "does this feature exist on my system?" or "how should I perform some particular operation?" Well, in some ways, the "AT&T" system V7 is more like the "BSD" system 4.2BSD than like the "AT&T" system "System III" or "System V". In other ways, it's more like the other "AT&T" systems. And, in some ways, later releases of S5 are more like BSD than V7! (V7 had neither the "mkdir" nor the "rmdir" system call, nor the "directory library" - "opendir", "readdir", etc..) In addition, although some system may be thought of as "BSD-based", it may have the S5 feature you're looking for, or a "S5-based" system may have the BSD feature you're looking for. And, just to top things off, there may be features present in *some* "BSD-based" systems, as well as *some* "S5-based" systems, but not present in others. Trying to split the world into "AT&T" and "BSD" systems won't work. The world is more complicated than that. You should, instead, try to determine whether the particular feature for which you're looking is present. Your example is an almost-correct way of determining whether UNIX-domain sockets are present, although you should: 1) be including , not 2) be including before 3) be testing whether "S_IFSOCK" is defined, not "S_ISOCK". In some cases, there is no magic #define that will tell you whether a feature is present or not.