Path: utzoo!attcan!uunet!husc6!ogccse!blake!uw-beaver!cornell!mailrus!tut.cis.ohio-state.edu!unmvax!deimos.cis.ksu.edu!uxc!uxc.cso.uiuc.edu!gistdev!flint From: flint@gistdev.UUCP Newsgroups: comp.unix.wizards Subject: Re: generating code to run multiple tar Message-ID: <8800012@gistdev> Date: 26 Apr 89 15:08:00 GMT References: <18927@adm.BRL.MIL> Lines: 40 Nf-ID: #R:adm.BRL.MIL:18927:gistdev:8800012:000:2557 Nf-From: gistdev.UUCP!flint Apr 26 10:08:00 1989 If we can have a standardized list of errno values that everybody uses which match (well, they ought to be standardized anyway) we ought to be able to come up with a system call that will return standard info about the capabilities of the machine you are running on. (I don't believe anyone really cares what the machine is, they care what the capabilities of it are. 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. If I'm dumb enough to put in a test that asks whether I'm using SYSV or BSD to answer that question it will work now, and will break when SYSV R4.0 comes out.) So why not create something like this to test for machine capabilities: long machcap(); if (machcap(CSYMLINK)) {... /* if symbolic links are available */ You then define constants for each capability people might want to test for, just like you have defined constants (ENOENT, EDEADLOCK) for errno values. A command can then be created easily for use in scripts, etc. The biggest problem here is obvious: you're never going to have every capability that everyone might want to test for in the list, and on any given machine you are going to have a lot of capabilities in the list that will fall into obscurity fairly quickly. (ie, "Can this machine execute 68020 instructions" as a capability or "Can it execute 286 instructions" are things that you will probably want in the list but which will be fairly worthless in 10 years, just like the tests for pdp11 machines are now.) But the same goes for the errno returns, and that hasn't stopped us from trying to make those standard. (They have been updated somewhat, I've noted: "Not a typewriter", for one example.) A second problem is what to do with capabilities that exist in multiple versions: one answer is to define a constant for each version I suppose, (a prospect I find distasteful), a second alternative might be to have machcap return not just 0 or 1, but have any positive return indicate the version level of the capability. Another possibility might be to have it return a pointer at a struct full of info, but for most capabilities this is going to be real overkill. Flint Pellett, Global Information Systems Technology, Inc. 1800 Woodfield Drive, Savoy, IL 61874 (217) 352-1165 INTERNET: flint%gistdev@uxc.cso.uiuc.edu UUCP: {uunet,pur-ee,convex}!uiucuxc!gistdev!flint