From help-request at octave dot org Tue Dec 27 10:15:32 2005 Subject: Re: [OctDev] isunix() returns 1 under cygwin From: Etienne Grossmann To: Quentin Spencer Cc: William Poetra Yoga Hadisoeseno , Andy Adler , etienne@cs.uky.edu, Octave Help , etienne@cs.uky.edu Date: Tue, 27 Dec 2005 11:06:49 -0500 Hi All, thx for the answeres. In my case, checking octave_config_info("canonical_host_type") for "win" or "linux" seems to do what I want. Cheers, Etienne On Tue, Dec 27, 2005 at 08:10:56AM -0600, Quentin Spencer wrote: # William Poetra Yoga Hadisoeseno wrote: # # >On 12/27/05, Andy Adler wrote: # > # > # >>The semantics of 'isunix' depends on what you mean by UNIX. # >>Strictly speaking, only certain well defined OSes are UNIX. Linux, # >>for example, is not. # >> # >>On the other hand, maybe UNIX means OSes that behave like # >>UNIX in most ways. cygwin has UNIX process semantics # >>(ie. fork) and file semantics (symlinks, select on files, etc.) # >> # >>So, is cygwin UNIX? Clearly, a mingwin octave is not unix. # >> # >>Maybe isunix should make a specific test. # >> # >> # >> # > # >In Octave 2.9.4, isunix() is implemented as # > # >function retval = isunix () # > # > if (nargin == 0) # > retval = octave_config_info ("unix"); # > else # > usage ("isunix ()"); # > endif # > # >endfunction # > # >AFAIK, it returns 1 on Cygwin (I know this by reading the sources, so # >I'm not very sure) # > # > # > # # # If you look at the contents of octave_config_info, I think there are # other things you could use to extract the system type. On my linux box, # I see "unix = 1" and "windows = 0". I'm guessing that under cygwin you # get "unix = 1" and "windows = 1", so maybe testing # octave_config_info("windows") will always give you the correct answer # whether octave was built in cygwin or mingw. If all else fails, you # could try parsing octave_config_info("canonical_host_type"), which # usually contains "linux" on linux systems and "cygwin" (if I remember # correctly) on cygwin. # # -Quentin # -- Etienne Grossmann ------ http://www.cs.uky.edu/~etienne ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------