From: Erik Max Francis 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: NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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