www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/16/12:05:21

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3B2B82F0.3733B277@phekda.freeserve.co.uk>
Date: Sat, 16 Jun 2001 17:01:52 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: .files on servers are perceived as readonly
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010611112448 DOT 17383L-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:
> 
> On Sun, 10 Jun 2001, Richard Dawe wrote:
> > BTW Fileutils 3.16 is probably bitten by this bug now too. The source
> > for the 3.16 port appears to set the opendir flags in the same way.
[snip]
> So the latest binaries of v3.16 indeed have the same bug; the
> v2.01-compiled binaries did not.
> 
> Btw, the solution I suggested (see above) is not entirely correct: you
> indeed need to set __OPENDIR_NO_HIDDEN at startup, but instead of
> setting __OPENDIR_FIND_HIDDEN when you want the hidden files, you need
> to *reset* the __OPENDIR_NO_HIDDEN flag.  (That setting
> __OPENDIR_FIND_HIDDEN will not work is actually a subtle bug in
> readdir, which I will fix in the CVS.)

Below is a patch that implements your suggestion. This does seem to have
fixed the bug - thanks! This patch also includes a fix for the bug I found
where ls would emit spurious a <-[m escape sequence on exit.

Thanks, bye, Rich =]

*** /djgpp/gnu/filutil3.16/src/ls-msdos.c       Thu Apr 26 22:02:04 2001
--- c:/develop/ports/gnu.dev/filutil4.0/src/ls-msdos.c  Sat Jun 16
13:19:58 2001
***************
*** 1,6 ****
! /* MSDOS-specific functions for `ls'.
! 
!    Written by Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>  */
  
  #ifdef MSDOS
  
--- 1,12 ----
! /*
!  * MSDOS-specific functions for `ls'.
!  *
!  * Written by Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
!  *
!  * Copied from Fileutils 3.16 DJGPP port for use in Fileutils 4.0 DJGPP
port
!  * by Richard Dawe <richdawe AT bigfoot DOT com>. Modifications are indicated
by
!  * '(richdawe) ...' comments.
!  */
  
  #ifdef MSDOS
  
***************
*** 73,82 ****
--- 79,96 ----
    if (use_color)
      _djstat_flags &= ~_STAT_EXEC_EXT;
  
+   /* (richdawe) Default to skipping hidden files. */
+   __opendir_flags |= __OPENDIR_NO_HIDDEN;
+ 
    /* Find hidden files only if user specified -a.  */
    if (show_hidden)
      {
+       /* (richdawe) Eli advised me that setting __OPENDIR_FIND_HIDDEN
+        * will not work, because of a bug in DJGPP 2.03's libc. We also
need
+        * to clear __OPENDIR_NO_HIDDEN. */
        __opendir_flags |= __OPENDIR_FIND_HIDDEN;
+       __opendir_flags &= ~__OPENDIR_NO_HIDDEN;
+ 
        /* Find volume labels only if user specified both -a and -g.  */
        if (msdos_long_format)
        __opendir_flags |= __OPENDIR_FIND_LABEL;
***************
*** 146,152 ****
  static int
  msdos_screen_write (__FSEXT_Fnumber func, int *retval, va_list
rest_args)
  {
!   static char *cbuf = 0;
    static size_t cbuf_len = 0;
    /* Only dark colors mentioned here, so that bold has visible effect. 
*/
    static enum COLORS screen_color[] = {BLACK, RED, GREEN, BROWN,
--- 160,166 ----
  static int
  msdos_screen_write (__FSEXT_Fnumber func, int *retval, va_list
rest_args)
  {
!   static char *cbuf = NULL;
    static size_t cbuf_len = 0;
    /* Only dark colors mentioned here, so that bold has visible effect. 
*/
    static enum COLORS screen_color[] = {BLACK, RED, GREEN, BROWN,
***************
*** 207,212 ****
--- 221,236 ----
      {
        char *p = p_next;
  
+       /* (richdawe) Handle the null escape sequence (ESC-[m), which ls
uses
+        * to restore the original colour. */
+       if ((p[1] == '[') && (p[2] == 'm'))
+       {
+         textattr (norm_attr);
+         p += 3;
+         anchor = p_next = p;
+         continue;
+       }
+       
        if (p[1] == '[')        /* "Esc-[" sequence */
        {
          /* If some chars seen since the last escape sequence,

- Raw text -


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