From domi@saargate.de Thu Jun 17 10:48:01 1999
Return-Path: <domi@saargate.de>
Received: from dominik.saargate.de (domi.saargate.de [212.88.132.246])
	by hub.freebsd.org (Postfix) with ESMTP id C427015101
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 17 Jun 1999 10:47:57 -0700 (PDT)
	(envelope-from domi@saargate.de)
Received: from localhost (localhost [127.0.0.1])
	by dominik.saargate.de (8.9.3/8.8.7) with ESMTP id GAA02916
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 17 Jun 1999 06:49:52 +0200 (CEST)
	(envelope-from domi@saargate.de)
Message-Id: <Pine.BSF.4.10.9906170648520.2845-100000@dominik.saargate.de>
Date: Thu, 17 Jun 1999 06:49:52 +0200 (CEST)
From: Dominik Brettnacher <domi@saargate.de>
To: FreeBSD-gnats-submit@freebsd.org
Subject: "more" problems with long filenames

>Number:         12263
>Category:       bin
>Synopsis:       "more" problems with long filenames
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    hoek
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 17 10:50:00 PDT 1999
>Closed-Date:    Sun Dec 30 15:11:38 PST 2001
>Last-Modified:  Sun Dec 30 15:13:39 PST 2001
>Originator:     Dominik Brettnacher
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
>Environment:

	

>Description:

	When using "more <filename(s)>" with very long names (longer than
	your screen width), "more" shows more than one status line on the
	screen but it behaves as if there were only one status line.
	That gives some odd effects e.g when scrolling back or redrawing
	the screen with Ctrl-L. Another problem is that the first line
	displayed on the screen is already scrolled out.

>How-To-Repeat:

	Use "more <filename>" with a filename that consists or more
	characters than your terminal can display in one line.

>Fix:



>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: n_hibma 
State-Changed-When: Mon Jul 19 03:06:23 PDT 1999 
State-Changed-Why:  
Submitted patch to submitter 


Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: n_hibma 
Responsible-Changed-When: Mon Jul 19 03:06:23 PDT 1999 
Responsible-Changed-Why:  
Make sure I don't forgot to test and commit the patch myself. 

From: Nick Hibma <nick.hibma@jrc.it>
To: freebsd-gnats-submit@freebsd.org, domi@saargate.de,
	hoek@freebsd.org
Cc:  
Subject: Re: bin/12263: "more" problems with long filenames
Date: Mon, 19 Jul 1999 11:58:18 +0200

 It kind of undoes the effect of one line up ('k'), it has to be said
 :-(.
 
 Please try the following patch
 
 to be applied with (after uudecoding the patch below into
 /tmp/command.c.patch):
 
 	patch < /tmp/command.c.patch
 
 Tim, you have been CC:-ed because you seem to have done some work in the
 past, and if possible, could you review the patch. I have the feeling it
 could be more generic. Second, I am not sure about the use of sc_width.
 Should that be so_width?
 
 Cheers,
 
 Nick
 
 
 
 Uuencoded version:
 
 begin 644 /tmp/command.c.patch
 M+2TM('-R8R]U<W(N8FEN+VUO<F4O8V]M;6%N9"YC+F]R:6<)4W5N($IU;B`@
 M-B`Q-CHT,CHR,B`Q.3DY"BLK*R!S<F,O=7-R+F)I;B]M;W)E+V-O;6UA;F0N
 M8PE-;VX@2G5L(#$Y(#$Q.C4T.C4U(#$Y.3D*0$`@+3$V-BPW("LQ-C8L-R!`
 M0`H@"65X=&5R;B!I;G0@;&EN96YU;7,L('-H;W)T7V9I;&4["B`)97AT97)N
 M(&-H87(@*F-U<G)E;G1?;F%M92P@*F9I<G-T<V5A<F-H+"`J;F5X=%]N86UE
 M.PH@"6]F9E]T(&QE;BP@<&]S+"!C:%]L96YG=&@H*2P@<&]S:71I;VXH*2P@
 M9F]R=U]L:6YE*"D["BT)8VAA<B!P8G5F6S0P73L**PEC:&%R('!B=69;<V-?
 M=VED=&A=.PH@"B`)+RH*(`D@*B!I9B!N;W1H:6YG(&ES(&1I<W!L87EE9"!Y
 M970L(&1I<W!L87D@<W1A<G1I;F<@9G)O;2!L:6YE(#$["D!`("TR,C,L-R`K
 M,C(S+#$P($!`"B`)?0H@"65L<V4@>PH@"0ES;U]E;G1E<B@I.PHM"0EP=71S
 M='(H8W5R<F5N=%]N86UE*3L**PD)*'9O:60I('-N<')I;G1F*'!B=68L"BL)
 M"0DH<VEZ96]F*'!B=68I/G-C7W=I9'1H/R!S8U]W:61T:#H@<VEZ96]F*'!B
 M=68I*2TX+`HK"0D)(B5S(BP@8W5R<F5N=%]N86UE*3L**PD)<'5T<W1R*'!B
 M=68I.PH@"0EI9B`H:&ET7V5O9BD*(`D)"6EF("AN97AT7VYA;64I('L*(`D)
 @"0EP=71S='(H(CH@14Y$("AN97AT(&9I;&4Z("(I.PIT
 `
 end
 
 
 
 The plain text version for reference:
 
 --- src/usr.bin/more/command.c.orig     Sun Jun  6 16:42:22 1999
 +++ src/usr.bin/more/command.c  Mon Jul 19 11:54:55 1999
 @@ -166,7 +166,7 @@
         extern int linenums, short_file;
         extern char *current_name, *firstsearch, *next_name;
         off_t len, pos, ch_length(), position(), forw_line();
 -       char pbuf[40];
 +       char pbuf[sc_width];
  
         /*
          * if nothing is displayed yet, display starting from line 1;
 @@ -223,7 +223,10 @@
         }
         else {
                 so_enter();
 -               putstr(current_name);
 +               (void) snprintf(pbuf,
 +                       (sizeof(pbuf)>sc_width? sc_width:
 sizeof(pbuf))-8,
 +                       "%s", current_name);
 +               putstr(pbuf);
                 if (hit_eof)
                         if (next_name) {
                                 putstr(": END (next file: ");
 
 
 -- 
 Paranoid:
    perl -e 'use strict;' -e ...
 
 ISIS/STA, T.P.270, Joint Research Centre, 21020 Ispra, Italy
 

From: Dominik Brettnacher <domi@saargate.de>
To: "nick.hibma@jrc.it" <nick.hibma@jrc.it>
Cc: freebsd-gnats-submit@freebsd.org, hoek@freebsd.org
Subject: Re: bin/12263: "more" problems with long filenames
Date: Mon, 19 Jul 1999 17:49:34 +0200 (CEST)

 On Mon, 19 Jul 1999, nick.hibma@jrc.it wrote:
 
 > It kind of undoes the effect of one line up ('k'), it has to be said
 > >:-(.
 > Please try the following patch
 > to be applied with (after uudecoding the patch below into
 > /tmp/command.c.patch):
 > 	patch < /tmp/command.c.patch
 > Tim, you have been CC:-ed because you seem to have done some work in the
 > past, and if possible, could you review the patch. I have the feeling it
 > could be more generic. Second, I am not sure about the use of sc_width.
 > Should that be so_width?
 
 The patch seems to be useless: i can't access the first line of my file
 "aaaaaaaaaaaa...".
 
 
 -- 
 Dominik - http://www.saargate.de/~domi/
 
 

From: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To: Nick Hibma <nick.hibma@jrc.it>
Cc: freebsd-gnats-submit@freebsd.org, domi@saargate.de
Subject: Re: bin/12263: "more" problems with long filenames
Date: Mon, 19 Jul 1999 18:27:35 -0400

 On Mon, Jul 19, 1999 at 11:58:18AM +0200, Nick Hibma wrote:
 > 
 > Tim, you have been CC:-ed because you seem to have done some work in the
 > past, and if possible, could you review the patch. I have the feeling it
 > could be more generic. Second, I am not sure about the use of sc_width.
 
 Well, yes, it could be made more generic, but I suggest it's not worth
 the trouble.  I have a slightly grander vision for the prompt code
 (similar to less(1)'s configurable prompt) which, although it might
 take upto a year to materialize, should solve the problem in a more
 generic way.
 
 > Should that be so_width?
 
 "so_width" is the width required for the "enter standout mode"
 character.  On FreeBSD with syscons (or any modern terminal),
 so_width = 0.
 
 
 > The plain text version for reference:
 
 I like plaintext.  :)
 
 
 > --- src/usr.bin/more/command.c.orig     Sun Jun  6 16:42:22 1999
 > +++ src/usr.bin/more/command.c  Mon Jul 19 11:54:55 1999
 > @@ -166,7 +166,7 @@
 >         extern int linenums, short_file;
 >         extern char *current_name, *firstsearch, *next_name;
 >         off_t len, pos, ch_length(), position(), forw_line();
 > -       char pbuf[40];
 > +       char pbuf[sc_width];
 >  
 >         /*
 >          * if nothing is displayed yet, display starting from line 1;
 > @@ -223,7 +223,10 @@
 >         }
 >         else {
 >                 so_enter();
 > -               putstr(current_name);
 > +               (void) snprintf(pbuf,
 > +                       (sizeof(pbuf)>sc_width? sc_width:
 > sizeof(pbuf))-8,
 > +                       "%s", current_name);
 > +               putstr(pbuf);
 >                 if (hit_eof)
 >                         if (next_name) {
 >                                 putstr(": END (next file: ");
 
 Well, you're right, of course, this patch isn't generic enough.  There
 are plenty of ways to break it.  I'm not sure why the patch didn't
 work for Dominik (I haven't tried it myself, though).
 
 In some (as-yet) uncomitted modifications to more(1) that I've made, I
 have a function putxstr() that expands control characters properly and
 returns the number of characters printed.  I should probably give it
 another arg to make it do truncation also.
 
 Anyways, provided you figure out why this didn't work for Dominik, I
 would suggest commit it and then forget about it.  Eventually I expect
 to allow prompt specification strings and that will mean having to
 handle the truncation issue properly.
 
 
 -- 
 This is my .signature which gets appended to the end of my messages.
 
State-Changed-From-To: feedback->open 
State-Changed-By: hoek 
State-Changed-When: Tue Aug 17 16:14:22 PDT 1999 
State-Changed-Why:  
This more or less got left where it looks like it got left from the audit- 
trail, which pladces it more or less in my hands.  I want the state to 
be open. 


Responsible-Changed-From-To: n_hibma->hoek 
Responsible-Changed-By: hoek 
Responsible-Changed-When: Tue Aug 17 16:14:22 PDT 1999 
Responsible-Changed-Why:  
This more or less got left where it looks like it got left from the audit- 
trail, which places it more or less in my hands. 
I guess. 

From: Dominik Brettnacher <domi@saargate.de>
To: freebsd-gnats-submit@FreeBSD.org, domi@saargate.de,
	hoek@FreeBSD.org
Cc:  
Subject: Re: bin/12263: "more" problems with long filenames
Date: Fri, 30 Mar 2001 22:36:56 +0200 (CEST)

 I think this report should be closed because the introduction of less(1)
 solved the problem.
 
 -- 
 Dominik - http://www.brettnacher.org/users/dominik/
 
 "I think we'd order our lives via 1-800 numbers if we could."
 			-- Douglas Coupland
 
 
State-Changed-From-To: open->closed 
State-Changed-By: hoek 
State-Changed-When: Sun Dec 30 15:11:38 PST 2001 
State-Changed-Why:  
Okay, closed as per Brett's suggestion since the old more(1) 
has been superceded by less(1). 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=12263 
>Unformatted:
