bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fileutils-4.0.43 - ls] 'ls a b' when a doesn't exist and isdir(b)


From: Stephane CHAZELAS
Subject: Re: [fileutils-4.0.43 - ls] 'ls a b' when a doesn't exist and isdir(b)
Date: Fri, 20 Apr 2001 19:33:54 +0200
User-agent: Mutt/1.3.14i

On Thu, Apr 19, 2001 at 08:50:04PM +0200, I wrote:
> On Wed, Apr 18, 2001 at 10:18:55PM +0200, I wrote:
> > Here is a simple patch that should fix it:
> [buggy patch]
> 
> Oops, this one should be better, sorry:
[other buggy patch]

Ok, I guess you'll find out the right way to fix this.
My previous patch failed with ls -R dir

I hope this one is better:

--- ls.c~       Wed Apr 18 21:27:52 2001
+++ ls.c        Fri Apr 20 19:22:27 2001
@@ -854,6 +854,7 @@
 {
   register int i;
   register struct pending *thispend;
+  int nfiles_requested;
 
   program_name = argv[0];
   setlocale (LC_ALL, "");
@@ -901,7 +902,8 @@
 
   clear_files ();
 
-  if (i < argc)
+  nfiles_requested=argc - i;
+  if (nfiles_requested >= 0)
     dir_defaulted = 0;
   for (; i < argc; i++)
     {
@@ -929,7 +931,7 @@
       if (pending_dirs)
        DIRED_PUTCHAR ('\n');
     }
-  else if (pending_dirs && pending_dirs->next == 0)
+  else if (nfiles_requested <= 1 && pending_dirs && pending_dirs->next == 0)
     print_dir_name = 0;
 
   while (pending_dirs)


-- 
Stéphane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]