delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/08/26/11:45:47

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10108261514.AA18733@clio.rice.edu>
Subject: Re: fstat patch for redirected char handles (NT/W2K/XP)
To: acottrel AT ihug DOT com DOT au (Andrew Cottrell)
Date: Sun, 26 Aug 2001 10:14:15 -0500 (CDT)
Cc: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii),
djgpp-workers AT delorie DOT com (DJGPP developers)
In-Reply-To: <022f01c12e24$a8b57850$0a02a8c0@acceleron> from "Andrew Cottrell" at Aug 26, 2001 09:45:43 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> > > I have just built less and tried the following tests
> > > a) less seek.c
> > > b) less < seek.c
> > > c) type seek.c | less
> > >
> > > They all work and there appears to be no characters mising on the first
> or
> > > last lines of the file. The file looks like it is displayed correctly.
> > >
> > > Are there any other checks required?
> >
> > Try pressing G and g several times, especially after invoking Less with
> > the -M switch.  Also try "dir /s \ | less -M" and try G and g again.
> > Look closely at the status line, the one which shows the line number
> > etc.  Compare with what you see on Windows 9X.
> 
> Repeated the tests with pressing G and g serveral times with and without
> the -M option all work okay and the status line looks on Win2K less with
> 2.04 and patched LIBC looks that same as Less with 2.03 (from Simtel) on Win
> 98 box.
> 
> The hard drive loves the "dir /s \ | less -M" other one, sector read...... I
> could not perform the same test on both becasue when I ran this on WIn 98
> with less the command would not display anything, the lan lights were woking
> overtime.
> 
> I compared the display using the command on a differnet hard drive and both
> looked like they displayed the correct info.
> 
> One item I did spot that was comon to both was that that status bar with
> running "less -M seek.c" showed  "seek.c lines 1-48/150 33%", but "dir /s \
> | less -M"  showed "lines 1-49". The same occured on Win 98 and Win 2K.
> 
> Any ideas why the display number of lines is different? They are the same
> for "less -M seek.c" and "type seek.c | less -M".

Since this fixes patch, and works well with less, any reason not to commit
the following?  Even if you dup the handle this should be OK once fstat()ed 
which calls filelength.  This doesn't mean we don't look at the other seek
stuff.  I would also enhance the comment before commit to say why.

*** filelen.bak	Sun Jan 28 10:19:22 2001
--- filelen.c	Sun Aug 26 00:39:16 2001
*************** filelength(int fhandle)
*** 28,34 ****
    long           retval;
  
    /* Use the LFN API when available to get the file length.  */
!   if (_USE_LFN)
    {
      regs.x.ax = 0x71A6;
      regs.x.bx = fhandle;
--- 28,34 ----
    long           retval;
  
    /* Use the LFN API when available to get the file length.  */
!   if (_USE_LFN && (fhandle != 0 || _osmajor != 5 || _get_dos_version(1) != 0x532))
    {
      regs.x.ax = 0x71A6;
      regs.x.bx = fhandle;

- Raw text -


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