delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/12/19:48:11

Message-ID: <3A36C6DF.C42AF097@averstar.com>
Date: Tue, 12 Dec 2000 19:46:23 -0500
From: George Snyder <gjs AT averstar DOT com>
Organization: AverStar, Inc.
X-Mailer: Mozilla 4.7 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
CC: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, djgpp AT delorie DOT com
Subject: Re: Current Directory Switches to Short Format on NT
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1001212112751 DOT 24447L-100000 AT is>
Reply-To: djgpp AT delorie DOT com

> ...
>
> Why is it important what does the shell prompt display?  What's
> important is what do library functions such as `getcwd' report.  Can
> you check what does `getcwd' return when you have ntlfn loaded?

I wrote a trivial program which prints the result of getcwd(), built with MS
Dev Studio 6.0, and added it to the previous example.  The first call returns
the long directory path as expected; the call after "ls.exe" returns the
short form:

     E:\Program Files > E:\gjs\C\Experiments\getcwd\Debug\getcwd.exe
     getcwd = 'E:\Program Files'

     E:\Program Files > E:\gjs\gnu\bin\ls
     AverStar                 Microsoft Visual Studio  seti
     Java                     RadView
     Jikes                    Visigenic

     E:\PROGRA~1 > E:\gjs\C\Experiments\getcwd\Debug\getcwd.exe
     getcwd = 'E:\PROGRA~1'

> > After this, programs which read the current directory name can go
> > wrong.  For example, a licensed CM program which gets the current
> > directory name and looks that up in a database fails, because the
> > database lists the long filename format.
>
> If this indeed happens, it might be a bug in ntlfn, so please provide
> a short test program which exhibits the problem.

Here's the trivial source code:

     #include <stdio.h>
     #include <direct.h>

     int main(int argc, char* argv[])
     {
         char buffer[101];

         if (getcwd(buffer, 100) != NULL) {
             printf("getcwd = '%s'\n", buffer);
             return 0;
         } else {
             printf("getcwd failed\n");
             return 1;
         }
     }

The executable is available at http://www.averstar.com/~gjs/tmp/getcwd.exe.

> > Are 32-bit executable versions of the v2gnu programs available?
> The FAQ has a pointer to the Cygwin ports in section 3.6.

Thanks for the pointer.

-- George Snyder


- Raw text -


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