Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sdcrdcf.UUCP Path: utzoo!linus!philabs!prls!amdimage!amdcad!amd!pesnta!pertec!scgvaxd!trwrb!sdcrdcf!lwall From: lwall@sdcrdcf.UUCP (Larry Wall) Newsgroups: net.unix-wizards Subject: Re: Re: Re(cap): Which Unix? Message-ID: <1984@sdcrdcf.UUCP> Date: Wed, 15-May-85 19:25:43 EDT Article-I.D.: sdcrdcf.1984 Posted: Wed May 15 19:25:43 1985 Date-Received: Mon, 20-May-85 04:16:09 EDT References: <237@dadla.UUCP> <179@hadron.UUCP> <227@ucbcad.UUCP> Reply-To: lwall@sdcrdcf.UUCP (Larry Wall) Distribution: net Organization: System Development Corp. R+D, Santa Monica Lines: 51 No, No, NO! "Which Unix?" is almost always the WRONG question to be asking in the first place. "Which machine?" is usually the wrong question too. ********************** *** Which feature? *** ********************** is the right question to ask if you really and truly want to write portable code. If you use machine names and OS names in your #ifdefs, you are probably only portable to the machines in use today, and then only to the ones you know about, and then only to the ones that haven't been hacked on by somebody. There is SO much hybridization and cross-fertilization (did I hear someone say "bastardization"?) going on right now in the Unix world that a list of machine and Unix types that differentiated all the features would stretch from here to Pioneer 1. Instead of saying #if defined(bsd) || defined(pyr) || defined(vms) || defined(sun) write something like #ifdef CANDOIT and then define CANDOIT in a config.h sort of file. BUT, you say, then I have to depend on the turkey at the other end of the wire to define or undefine CANDOIT. Wrongo. Write yourself a little shell script (well, may not so little) that goes out and checks for the feature you're interested in and writes the config.h file itself. This has several advantages: 1) You don't have to depend (so much) on the turkey at the other end of the wire to correctly edit your config.h or (yikes!) your program. 2) You don't have to depend on the turkeys who wrote the system to have gotten their whatami.h files set up right. 3) You don't have to try and remember which systems do or don't what. 4) Your system will be portable to all kinds of systems you've never even heard of. 5) You'll get lots of compliments on how clever you are. 6) You get the fun of figuring out how to write the shell script, unless you cheat and look at Configure from the rn kit, in which case you get the fun of looking at Configure. 7) You get to write funny notes like this one to those who don't know better. You might be surprised how much you can find out from inside a shell script. It's really the only way to go. Check it out. Larry Wall {allegra,burdvax,cbosgd,hplabs,ihnp4,sdcsvax}!sdcrdcf!lwall