delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/09/11/00:21:26

Date: Wed, 11 Sep 1996 07:18:50 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Robert Hoehne <robert DOT hoehne AT Mathematik DOT TU-Chemnitz DOT DE>
Cc: DJ Delorie <dj AT delorie DOT com>, djgpp-workers AT delorie DOT com
Subject: Re: V2 alpha 980908 -- stat.c
In-Reply-To: <Pine.HPP.3.91.960910163112.26979A-100000@newton.mathematik.tu-chemnitz.de>
Message-Id: <Pine.SUN.3.91.960911071402.12610A-100000@is>
Mime-Version: 1.0

> I have tested it in several cases and include here the resulting outputs:
> In my opinion the bug has something to do with no correct identifying
> a drive, which is created with subst and also some wrong things, when
> I start the program 'stat.exe' with or without redir.

The case of SUBST was broken.  Patches below.  Anybody who works seriously 
with SUBSTed drives should patch libc.a and rebuild every tool in use, 
because *nothing* will work on a SUBSTed drive without this patch (`stat' 
is used too heavily).  Sorry about the mess.

Other than the case of SUBST, I found nothing wrong with the last 
snapshot of `stat', but I don't have access to Windows 95, so if there 
are further problems, please tell me about them.

*** stat.c~0	Sun Sep  1 01:09:32 1996
--- stat.c	Tue Sep 10 22:25:10 1996
*************** stat_assist(const char *path, struct sta
*** 552,561 ****
       original drive letter; other redirectors will probably do their
       weird things.  This could totally confuse FindFirst.  DOS_PATH takes
       the pathname from CANON_PATH, but replaces the UNC prefix with a
!      drive letter.
     */
!   if (path_offset >= 0)
      strcpy (dos_path + 3, canon_path + path_offset);
  
    if (!__findfirst(dos_path, &ff_blk, ALL_FILES))
      {
--- 552,565 ----
       original drive letter; other redirectors will probably do their
       weird things.  This could totally confuse FindFirst.  DOS_PATH takes
       the pathname from CANON_PATH, but replaces the UNC prefix with a
!      drive letter.  (However, if CANON_PATH comes with a drive different
!      from what we got from PATH, we will just use PATH in FindFirst,
!      because the *real* drive might be illegal, as in JOIN.)
     */
!   if (path_offset >= 0 && drv_no == dos_path[0])
      strcpy (dos_path + 3, canon_path + path_offset);
+   else
+     strcpy (dos_path, path);
  
    if (!__findfirst(dos_path, &ff_blk, ALL_FILES))
      {
*************** main(int argc, char *argv[])
*** 900,907 ****
        exit(0);
      }
  
!   stat(*argv, &stat_buf);
!   fprintf(stderr, "DOS %d.%d (%s)\n", _osmajor, _osminor, _os_flavor);
    argc--; argv++;
  
    _djstat_flags = (unsigned short)strtoul(*argv, &endp, 0);
--- 904,913 ----
        exit(0);
      }
  
!   if (stat(*argv, &stat_buf) != 0)
!     perror ("stat failed on argv[0]");
!   else
!     fprintf(stderr, "DOS %d.%d (%s)\n", _osmajor, _osminor, _os_flavor);
    argc--; argv++;
  
    _djstat_flags = (unsigned short)strtoul(*argv, &endp, 0);

- Raw text -


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