Subject: misc/1046: col(1) outputs blank line when given empty input file
To: None <gnats-admin@sun-lamp.cs.berkeley.edu>
From: Giles Lean <giles@nemeton.com.au>
List: netbsd-bugs
Date: 05/12/1995 18:20:04
>Number:         1046
>Category:       misc
>Synopsis:       col(1) outputs blank line when given empty input file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 12 18:20:03 1995
>Originator:     Giles Lean
>Organization:
Giles Lean                                             Nemeton Pty Ltd
<giles@nemeton.com.au>                           phone: +61 3 480 2118        
>Release:        1.0
>Environment:
	
System: NetBSD nemeton.com.au 1.0 NetBSD 1.0 (NEMETON) #16: Sat Feb 11 09:03:41 EST 1995 giles@nemeton.com.au:/usr/src/sys/arch/i386/compile/NEMETON i386


>Description:
	When given empty input col(1) outputs a blank line. This is not
	consistent with the SysV behaviour.

>How-To-Repeat:
	col < /dev/null
>Fix:
*** src/usr.bin/col/col.c.orig	Sun Mar 26 21:24:09 1995
--- src/usr.bin/col/col.c	Sat May 13 09:04:23 1995
***************
*** 313,319 ****
  	nblank_lines = max_line - this_line;
  	if (max_line & 1)
  		nblank_lines++;
! 	else if (!nblank_lines)
  		/* missing a \n on the last line? */
  		nblank_lines = 2;
  	flush_blanks();
--- 313,319 ----
  	nblank_lines = max_line - this_line;
  	if (max_line & 1)
  		nblank_lines++;
! 	else if (!nblank_lines && l->l_max_col)
  		/* missing a \n on the last line? */
  		nblank_lines = 2;
  	flush_blanks();
>Audit-Trail:
>Unformatted: