delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/29/03:16:12

Date: Mon, 29 Dec 1997 10:12:39 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Rich Dawe <rd5718 AT irix DOT bris DOT ac DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Setting DOS box title under Win95
In-Reply-To: <ELv8EI.JMp@fsa.bris.ac.uk>
Message-ID: <Pine.SUN.3.91.971229101217.27720D-100000@is>
MIME-Version: 1.0

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 -


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