Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Apr 2001 01:50:01 -0700 (PDT)
From:      Peter Pentchev <roam@orbitel.bg>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/26283: column coredumps on specific input
Message-ID:  <200104020850.f328o1G25952@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/26283; it has been noted by GNATS.

From: Peter Pentchev <roam@orbitel.bg>
To: David Malone <dwmalone@maths.tcd.ie>
Cc: freebsd-bugs@FreeBSD.org
Subject: Re: bin/26283: column coredumps on specific input
Date: Mon, 2 Apr 2001 11:38:51 +0300

 On Mon, Apr 02, 2001 at 09:26:21AM +0100, David Malone wrote:
 > On Mon, Apr 02, 2001 at 01:20:03AM -0700, Peter Pentchev wrote:
 > 
 > >  Could you try the following patch?  It works for me..
 > >  (As a side point, maybe the tab-size should be configurable.. but that's
 > >   another battle ;)
 > 
 > I think that this leaves the problem open in some other cases.
 > Try:
 > 
 > 	echo "aaaaaaaaaaaa" | ./column -c 15
 > 
 > maxlength probably needs to be rounded up to the nearest tabstop
 > before the test is carried out.
 
 Yes, that was my first idea; I can't really remember what was wrong
 with it, why didn't I fix it that way :)
 
 Updated patch follows..
 
 As another side point, column -t (table mode) seems to just ignore
 the terminal size.. is that The Right Thing (tm)?
 
 G'luck,
 Peter
 
 -- 
 .siht ekil ti gnidaer eb d'uoy ,werbeH ni erew ecnetnes siht fI
 
 Index: src/usr.bin/column/column.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.bin/column/column.c,v
 retrieving revision 1.4
 diff -u -r1.4 column.c
 --- src/usr.bin/column/column.c	1998/12/06 22:58:18	1.4
 +++ src/usr.bin/column/column.c	2001/04/02 08:37:21
 @@ -52,6 +52,8 @@
  #include <string.h>
  #include <unistd.h>
  
 +#define	TAB	8
 +
  void  c_columnate __P((void));
  void *emalloc __P((int));
  void  input __P((FILE *));
 @@ -120,6 +122,7 @@
  	if (!entries)
  		exit(eval);
  
 +	maxlength = (maxlength + TAB) & ~(TAB - 1);
  	if (tflag)
  		maketbl();
  	else if (maxlength >= termwidth)
 @@ -131,14 +134,12 @@
  	exit(eval);
  }
  
 -#define	TAB	8
  void
  c_columnate()
  {
  	int chcnt, col, cnt, endcol, numcols;
  	char **lp;
  
 -	maxlength = (maxlength + TAB) & ~(TAB - 1);
  	numcols = termwidth / maxlength;
  	endcol = maxlength;
  	for (chcnt = col = 0, lp = list;; ++lp) {
 @@ -166,7 +167,6 @@
  {
  	int base, chcnt, cnt, col, endcol, numcols, numrows, row;
  
 -	maxlength = (maxlength + TAB) & ~(TAB - 1);
  	numcols = termwidth / maxlength;
  	numrows = entries / numcols;
  	if (entries % numcols)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104020850.f328o1G25952>