Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Sep 2001 23:07:05 +0200 (CEST)
From:      Sven Klose <sven@devcon.net>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/30467: 
Message-ID:  <200109092107.f89L74X96593@copei.research.devcon.net>

next in thread | raw e-mail | index | archive | help

>Number:         30467
>Category:       bin
>Synopsis:       
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 09 14:00:03 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Sven Klose
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD copei.research.devcon.net 5.0-CURRENT FreeBSD 5.0-CURRENT #6: Sun Sep 9 14:40:04 CEST 2001 root@copei.research.devcon.net:/usr/src/sys/i386/compile/COPEI i386


>Description:

When trying to find out the maximum column width in prepfile() the element
pointer ep is not initialised in case the -z option is used without -t.

>How-To-Repeat:
    ls | rs -z
>Fix:

    This fix inserts the missing pointer initialisation and removes misplaced
    debugging code.

*** rs.c.orig	Sun Sep  9 22:38:48 2001
--- rs.c	Sun Sep  9 22:33:22 2001
***************
*** 289,312 ****
  				colwidths[i] = max + gutter;
  			}
  		else
! 			for (i = 0; i < ocols; i++) {
  				for (j = i; j < nelem; j += ocols)
  					if ((n = strlen(ep[j])) > max)
  						max = n;
  				colwidths[i] = max + gutter;
  			}
  	}
- 	/*	for (i = 0; i < orows; i++) {
- 			for (j = i; j < nelem; j += orows)
- 				prints(ep[j], (j - i) / orows);
- 			putchar('\n');
- 		}
- 	else
- 		for (i = 0; i < orows; i++) {
- 			for (j = 0; j < ocols; j++)
- 				prints(*ep++, j);
- 			putchar('\n');
- 		}*/
  	else
  		for (i = 0; i < ocols; i++)
  			colwidths[i] = colw;
--- 289,301 ----
  				colwidths[i] = max + gutter;
  			}
  		else
! 			for (ep = elem, i = 0; i < ocols; i++) {
  				for (j = i; j < nelem; j += ocols)
  					if ((n = strlen(ep[j])) > max)
  						max = n;
  				colwidths[i] = max + gutter;
  			}
  	}
  	else
  		for (i = 0; i < ocols; i++)
  			colwidths[i] = colw;
***************
*** 319,326 ****
  	n = orows * ocols;
  	if (n > nelem && (flags & RECYCLE))
  		nelem = n;
- 	/*for (i = 0; i < ocols; i++)
- 		warnx("%d is colwidths, nelem %d", colwidths[i], nelem);*/
  }
  
  #define	BSIZE	2048
--- 308,313 ----
>Release-Note:
>Audit-Trail:
>Unformatted:
     rs crashes when option -z is used without -t.

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?200109092107.f89L74X96593>