www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/18/05:17:06

Date: Tue, 18 Feb 1997 11:58:41 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: George Foot <gfoot AT mc31 DOT merton DOT ox DOT ac DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Forgive my ignorance, but can someone answer a question for me?
In-Reply-To: <5e9bn0$i63@news.ox.ac.uk>
Message-ID: <Pine.SUN.3.91.970218115812.20000D-100000@is>
MIME-Version: 1.0

On 17 Feb 1997, George Foot wrote:

> Since DJGPP is a Unix-style environment, wouldn't it be sensible to refer to
> the drives as /c/djgpp/bin/gcc.exe, /d/prog/myprog/myprog.cc, etc? Maybe not
> force this notation, since the programs are running on Dos systems, but just
> allow it so that Unix-based programs can be ported more easily.
> 
> OTOH, this would interfere with people who do have directories called c, d,
> etc. in their root directory. Maybe there's a symbol which is valid in Unix
> filenames but not in Dos ones? Then the drive-directories could be prefixed
> with this symbol.

The port of `bash' uses double slash "//d/djgpp/bin".  This is AFAIK
the only way this can work, since Unix programs explicitly code the
`/' character as the first character of absolute pathnames; any other
prefix character will still need DOS-specific code.

However, building this convention into DJGPP means you have to rewrite
some low-level file-oriented functions, because DOS knows nothing
about such filenames (the current code in libc collapses multiple
slashes into a single slash).  As always with DJGPP, until there's
somebody with enough motivation to sit down and do it, this won't be
done.

More important, even if such a notation would be introduced into
DJGPP, it won't solve the problem entirely, because users of programs
are still entitled to call them with DOS-style backslashified and
drivified pathnames such as "D:\DJGPP\BIN\GCC.EXE".  Forcing people to
use only Unix-style pathnames is bad idea IMHO, in particular because
DJGPP tools might be called by other programs which don't know about
forward slashes.  So you still have to somehow canonicalize the
pathnames before they are used.

The easiest solution to this dilemma is to convert all pathnames that
the program gets to the Unix-style form before `main' is called.  That
is what the DJGPP port of GNU Fileutils does (it defines a function
with the constructor attribute, so that the startup code calls it
before `main').  However, it is not always easy to know which
command-line arguments are filenames and which aren't until *after*
you have parsed them.  (In Fileutils, this happens to be easy, but
that's an exception rather than a rule.)  And of course, there are
programs that read filenames from sources other that the command line
(like files or communication lines) at run time...  Sorry, the pains
of porting to DOS just won't go away that easily.

- Raw text -


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