Mail Archives: djgpp-workers/1997/08/26/09:55:22
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 -