www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/08/26/09:55:22

Date: Tue, 26 Aug 1997 16:53:51 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Subject: Re: `rename' under LFN
In-Reply-To: <Pine.SUN.3.91.970826164008.6086E-100000@is>
Message-ID: <Pine.SUN.3.91.970826165223.6086G-100000@is>
MIME-Version: 1.0

On Tue, 26 Aug 1997, Eli Zaretskii wrote:

> The following patch makes `_truename' try once more but with CX=0 if the 
> call with CX=2 fails.

Sorry, my finger was too easy on the SEND button.  Here's that patch:

*** src/libc/dos/dos/truename.c~1	Sun Nov  3 12:39:28 1996
--- src/libc/dos/dos/truename.c	Tue Aug 26 14:48:52 1997
*************** _truename(const char *file, char *buf)
*** 53,58 ****
--- 53,59 ----
    unsigned short  our_mem_selector = _my_ds();
    int             e                = errno;
    unsigned	  use_lfn	   = _USE_LFN;
+   int		  first_time	   = 1;
  
    char true_name[MAX_TRUE_NAME];
    char file_name[MAX_TRUE_NAME], *name_start = file_name, *name_end;
*************** _truename(const char *file, char *buf)
*** 111,116 ****
--- 112,118 ----
    /* According to Ralph Brown's Interrupt List, can't make the input
       and output buffers be the same, because it doesn't work for early
       versions of DR-DOS.  */
+  lfn_retry:
    regs.x.ds = regs.x.es = __tb_segment;
    regs.x.si = __tb_offset;
    regs.x.di = __tb_offset + MAX_TRUE_NAME;
*************** _truename(const char *file, char *buf)
*** 122,127 ****
--- 124,138 ----
  
    if (regs.x.flags & 1)
      {
+       if (use_lfn && first_time)
+ 	{
+ 	  /* If the file doesn't exist, 217160/CX=2 fails.  Try again
+ 	     with CX=0, so that this time it won't validate the path.  */
+ 	  first_time = 0;
+ 	  regs.x.ax = 0x7160;
+ 	  regs.x.cx = 0;
+ 	  goto lfn_retry;
+ 	}
        errno = __doserr_to_errno(regs.x.ax);
        return (char *)0;
      }

- Raw text -


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