Mail Archives: djgpp-workers/2000/03/02/06:40:50
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 -