delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/25/07:28:00

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: dos/unix defines
Date: Thu, 24 Apr 1997 09:52:54 -0700
Organization: Alcyone Systems
Lines: 25
Message-ID: <335F8FE6.3208EFA4@alcyone.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970424143457 DOT 11402Q-100000 AT is>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii wrote:

> There is no general way to do that.  One solution which I find to work
> reasonably well is to test for COMSPEC, like so:
> 
>         ifdef COMSPEC
>         ... DOS stuff ...
>         else
>         ... Unix stuff ...
>         endif

I use an even simpler method, which is guaranteed to work.  I simply
define a macro for whichever platform is appropriate (MSDOS, LINUX,
WINDOWS, MACINTOSH, SUNOS, etc.) and give it to the makefile/project.
Much easier that way, and it can (obviously) be generalized to any
platform/compiler/runtime combination, because you're doing the work of
making the #defines.

-- 
       Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com
                     Alcyone Systems /   web / http://www.alcyone.com/max/
San Jose, California, United States /  icbm / 37 20 07 N  121 53 38 W
                                   \
                      "The future / is right there."
                                 / Bill Moyers

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019