🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #217

Bug in fold program from textutils-1.3

#217
From: Eric Backus
Date: Fri, 07 Aug 1992 21:17
34 lines
1527 bytes
The 'fold' program found in textutils-1.3 folds lines to one character
less than is requested.  For example, it creates 79-character lines
when 80 characters is the requested width.  If you request a linewidth
of one ("fold -w1 myfile.txt"), the fold program goes into an infinite
loop.

Neigher of these behaviors is seen with the 'fold' program found on
HP-UX 8.0, so I assume they are bugs.

Following is a one-line patch to fix the problem.
--
				Eric Backus
				ericb%hplsla@hplabs.hp.com
				(206) 335-2495

*** textutils-1.3/src/fold.c	Fri Aug  7 14:07:13 1992
--- textutils-1.3/src/fold.c.orig	Fri Aug  7 14:05:39 1992
***************
*** 155,161 ****
      rescan:
        column = adjust_column (column, c);
  
!       if (column > width)
  	{
  	  /* This character would make the line too long.
  	     Print the line plus a newline, and make this character
--- 155,161 ----
      rescan:
        column = adjust_column (column, c);
  
!       if (column >= width)
  	{
  	  /* This character would make the line too long.
  	     Print the line plus a newline, and make this character
Technical Details
Message-ID: <9208072117.AA09420@labejb.lsid.hp.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!lsid.hp.com!ericb

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!lsid.hp.com!ericb
From: ericb@lsid.hp.com (Eric Backus)
Subject: Bug in fold program from textutils-1.3
Message-ID: <9208072117.AA09420@labejb.lsid.hp.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 7 Aug 1992 21:17:03 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 35