www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/06/24/19:11:36

Date: Thu, 24 Jun 93 18:52:26 EDT
From: peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: several questiond from new user

> > 1. If you call getcwd(buf,255) you will get the current working
> >    directory but without the DOS drive.
> How many unix programs will break when you change this?  It sounds
> like an easy change.

I will comment that this behavior broke some of my DOS code when ported
to djgcc.  I would vote for including the drive letter in the output of
getcwd.  If this turns out to be a controversial issue, a possible solution
would be to make getcwd a macro, defined as something like

#if defined(DOS_GETCWD)
	#define getcwd(a,b) dos_like_getcwd(a,b)
#elif defined(UNIX_GETCWD)
	#define getcwd(a,b) unix_like_getcwd(a,b)
#else
	#error must define DOS_GETCWD or UNIX_GETCWD to select getcwd implementation
#endif

This definition would go in the .h file which now contains the getcwd
prototype, and if you don't include that prototype, you get a compiler warning
and a linker error.  The advantage of this definition is that it beats you
over the head and says "here's a subtle difference between DOS and Unix, which
one do you want" rather than leaving a bug which might only be triggered if
the current directory is the root.

- Raw text -


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