delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/11/05/10:00:00

Date: Tue, 5 Nov 1996 16:50:07 +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: DJGPP workers <djgpp-workers AT delorie DOT com>, DJ Delorie <dj AT delorie DOT com>
Subject: Re: Problems with opendir() and glob()
In-Reply-To: <Pine.HPP.3.95.961104120658.9556E-100000@newton.mathematik.tu-chemnitz.de>
Message-Id: <Pine.SUN.3.91.961105164202.2535A-100000@is>
Mime-Version: 1.0

On Mon, 4 Nov 1996, Robert Hoehne wrote:

> The glob function (and probably also some other function) still
> do not handle correct filenames, which start with a dot
> (which are possible in Win 95 with LFN enabled). For checking
> it do a
> 
> touch .gdbint
> 
> and then a
> 
> ls .gdb*
> 
> and the file is not found.

Yep, it's a bug in `glob' (has been there since v2.0, as far as I could 
see).  It assumed that any filename which begins with a dot is either "." 
or ".." and ignored them, but this isn't true anymore on LFN platforms.
With the patch below, "ls .gdb*" now finds `.gdbinit'.

DJ, I have uploaded file- text- and sh-utils linked against the library
with all the latest patches to your /incoming.  Sh-utils got a minor
improvement ("test -x prog" will now also find prog.exe, prog.com etc.),
so I've uploaded the source distribution also. 

*** src/libc/posix/glob/glob.c~0	Tue Nov  5 13:53:50 1996
--- src/libc/posix/glob/glob.c	Tue Nov  5 14:20:14 1996
*************** glob_dirs(const char *rest, char *epathb
*** 105,111 ****
    {
      char short_name[13];
  
!     if ((ff.ff_name[0] != '.') && (ff.ff_attrib & FA_DIREC))
      {
        int i;
        char *tp;
--- 105,112 ----
    {
      char short_name[13];
  
!     if ((ff.ff_attrib & FA_DIREC)
! 	&& (strcmp(ff.ff_name, ".") && strcmp(ff.ff_name, "..")))
      {
        int i;
        char *tp;
*************** glob2(const char *pattern, char *epathbu
*** 287,293 ****
    {
      int i;
      char fshort[13];
!     if (ff.ff_name[0] != '.')
      {
        /* Long filenames are never lower-cased!  */
        if (lower
--- 288,295 ----
    {
      int i;
      char fshort[13];
!     if ((ff.ff_attrib & FA_DIREC) == 0
! 	|| (strcmp(ff.ff_name, ".") && strcmp(ff.ff_name, "..")))
      {
        /* Long filenames are never lower-cased!  */
        if (lower

- Raw text -


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