delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/03/02/06:40:50

Date: Thu, 2 Mar 2000 11:09:24 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Mariano Alvarez =?iso-8859-1?Q?Fern=E1ndez?= <malfer AT teleline DOT es>
cc: "djgpp-workers AT delorie DOT com" <djgpp-workers AT Delorie DOT com>
Subject: Re: short file names when using LFN
In-Reply-To: <38BD6169.BAFB42CE@teleline.es>
Message-ID: <Pine.SUN.3.91.1000302110852.24728F-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 1 Mar 2000, Mariano Alvarez =?iso-8859-1?Q?Fern=E1ndez?= wrote:

> >      putenv ("LFN=n");
> >      _truename (long_name, short_name);
> >      putenv ("LFN=y");
> 
> No, sorry, this don't work to get the real sfn of a file.

Please post the details.  The short test program attached below works
for me.

> > > Now, I only need the put routine :-) I'm playing with a crazy idea:
> > > do the copy, compare the short filenames
> > > if they don't match rename the copied file adding .00n
> > > do another copy and try again
> > > when the short filenames match, delete the bad copies.
>
> > I don't understand what are you trying to accomplish.  Please
> > explain.
> 
> I mailed about this to the general list, I want a copy utility who take care
> about sfn and lfn of each file.

This is AFAIK impossible.  But I still don't think I understand why do
you think your idea should work.  Are you assuming that Windows
eventually runs out of the numeric tails and begins to reuse them?


#include <sys/stat.h>
#include <stdlib.h>
#include <stdio.h>

int main (int argc, char *argv[])
{
  char short_name[FILENAME_MAX];
  const char *long_name = argc > 1 ? argv[1] : argv[0];

  putenv ("LFN=n");
  _truename (long_name, short_name);
  putenv ("LFN=y");
  printf ("`%s' -> `%s'\n", long_name, short_name);
  return 0;
}

- Raw text -


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