www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/19/04:47:25

Date: Tue, 19 Jan 1999 11:42:59 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Koehler <koehler AT netcom DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: djgpp (dos) preproccessor directive
In-Reply-To: <koehlerF5s8Kz.M8q@netcom.com>
Message-ID: <Pine.SUN.3.91.990119114232.12893K-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Tue, 19 Jan 1999, Koehler wrote:

> I now need to differentiate between unix and dos (to differentiate
> system() calls of 'rm' and 'del') in one of my programs.

You could simply distribute the DJGPP port of `rm' with your program,
and thus eliminate the need for any change.

Another possibility is to produce the same effect by calling library
functions.  For example, use `remove' instead of launching an external
program.

> What (any?) preprocessor directives does djgpp (gcc, unix, dos, etc)
> set so that the following is possible:
> 
> #ifdef _SOME_DJGPP_FLAG_?_
> 	system("del file.dos");
> #else
> 	system("rm file.unix");
> #endif
>
> Sorry if the answer is "obvious", but I couldn't find it!

Did you try to look in the FAQ?  It's there, in section 8.6.

Note, however, that there's nothing DJGPP-specific in the call to
`system' that you want to issue.  The same will work with any other
DOS or Windows compiler.  So testing __MSDOS__ and _WIN32 is probably
a better idea than one of the DJGPP-specific symbols listed in the
FAQ.

Also note that if "file.dos" can be an absolute file name, you need to
convert forward slashes to backslashes, or else DEL will choke.

- Raw text -


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