Mail Archives: djgpp/1997/12/29/03:16:12
On Sat, 27 Dec 1997, Rich Dawe wrote:
> function to get the *actual* short filename for a file given the long
> filename
What's wrong with `_truename' in the library? Doesn't it do its job?
For example, something like this should work (untested):
char *short_alias(const char *long_name)
{
char *lfn = getenv("LFN");
char *retval;
if (!lfn || tolower(*lfn) != 'n')
putenv ("LFN=n");
retval = _truename (long_name, NULL);
if (!lfn)
putenv ("LFN"); /* delete from environ */
else
putenv (lfn - 4); /* restore old setting */
return retval;
}
> /* Allocate some DOS memory */
> alloc_seg = __dpmi_allocate_dos_memory(APP_TITLE_BUFFER_PARA,
> &alloc_desc);
> if (alloc_seg == -1) return(-1);
You might have saved some work here by using the DJGPP transfer
buffer. It is already allocated for you and is at least 2KB-long,
(usually 16KB) which should be more than enough for getting the title.
- Raw text -