delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/10/13/12:41:02

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: Re: ls (of filutl32)
To: kuku AT acds DOT physik DOT rwth-aachen DOT de
Date: Tue, 13 Oct 92 9:10:52 PDT
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Mailer: Elm [revision: 66.25]

> Thanks to Eric Backus for making the gnu utils available and thanks to 
> David ? - name escaped me for a moment) for sponsoring with a ftp account.
> 
> When using ls with * argument I found that the .. file is also being
> listed. Is this correct behaviour or am I missing a patch for some
> libc system call?

It sounds like you are using go32 to do wild-card expansion.  The
expansion that go32 does is MS-DOS style, which means that "*" doesn't
match a filename that has a "." in the middle of it (you need "*.*" to
match all files).  MS-DOS style expansion also means that anything
after a "*" is ignored, so that "ls *test.c" is equivalent to "ls
*.c".  Also, for reasons that I don't understand, a "*" gets expanded
to include both "." and "..", which is what you are seeing.  This
seems wrong to me, but it's in go32 or maybe is built into MS-DOS and
is therefore out of my hands.

I personally disable the go32 wild-card expansion, by setting "noglob"
in the GO32 environment variable.  Then I use MS_SH200 as my shell
instead of COMMAND.COM, and I have the shell do the wild-card
expansion.  The advantage is that it does UNIX-style expansion, and I
don't have funny problems with "." and "..".

On a related note, I've noticed some strangeness even with "noglob" in
my GO32 environment variable.  For example, if I do "ls *~" to list my
emacs backup files, this works correctly if there is at least one
backup file (because the shell expands "*~" into a list of file names
before ls even sees it).  But if there aren't any backup files,
something is expanding the "*~" into "." or something like that.  This
behavior seems wrong, but I don't know how to fix it.  I assume the
cause is some low-level MS-DOS call which is doing wild-card
expansion.  Or maybe go32.exe is doing this even though noglob is set.
--
				Eric Backus
				ericb%hplsla AT hplabs DOT hp DOT com
				(206) 335-2495

- Raw text -


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