delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/25/23:13:30

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <20031126041306.35476.qmail@web21405.mail.yahoo.com>
Date: Tue, 25 Nov 2003 20:13:06 -0800 (PST)
From: Rick Rankin <rick_rankin AT yahoo DOT com>
Subject: CygUtils patch for last char repeat bug in lpr
To: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
Cc: Cygwin <cygwin AT cygwin DOT com>
MIME-Version: 1.0

--0-916528051-1069819986=:32174
Content-Type: text/plain; charset=us-ascii
Content-Id: 
Content-Disposition: inline

Chuck,

I finally had a chance to track down the bug that a few people have reported
where lpr was repeating the last character of a file. One of those really
stupid, "can't understand how I missed it before" type coding errors. Anyway,
I've attached a patch file and a changlog.

--Rick
--0-916528051-1069819986=:32174
Content-Type: text/plain; name="lpr.patch"
Content-Description: lpr.patch
Content-Disposition: inline; filename="lpr.patch"

Index: src/lpr/Printer.cc
===================================================================
RCS file: /cvs/cygwin-apps/cygutils/src/lpr/Printer.cc,v
retrieving revision 1.3
diff -u -r1.3 Printer.cc
--- src/lpr/Printer.cc	13 Jun 2003 23:39:10 -0000	1.3
+++ src/lpr/Printer.cc	26 Nov 2003 03:58:02 -0000
@@ -118,9 +118,8 @@
 
   char ch;
   char lastCh = '\0';
-  while (!in.eof())
+  while (in.get(ch))
   {
-    in.get(ch);
     if (!m_rawFlag && ch == '\n' && lastCh != '\r')
       put('\r');
     put(ch);
Index: src/lpr/lpr.cc
===================================================================
RCS file: /cvs/cygwin-apps/cygutils/src/lpr/lpr.cc,v
retrieving revision 1.2
diff -u -r1.2 lpr.cc
--- src/lpr/lpr.cc	11 Jun 2003 03:22:17 -0000	1.2
+++ src/lpr/lpr.cc	26 Nov 2003 03:58:02 -0000
@@ -48,13 +48,15 @@
 }
 
 const char * usageMessage =
-" [-h] [-D] [-d device] [-P device]\n"
+" [-h] [-D] [-d device] [-l] [-P device]\n"
 "\n"
 "where:\n"
 "\n"
 "  -h        does nothing. Accepted for compatibility.\n"
 "  -d device spools to the specified device.\n"
 "  -D        enable debugging output.\n"
+"  -l        prevent <LF> -> <CR><LF> processing. By default, standalone"
+"            <LF> characters are converted to <CR><LF>."
 "  -P device spools to the specified device.\n"
 "\n"
 "Notes:\n"

--0-916528051-1069819986=:32174
Content-Type: text/plain; name="lpr.changelog"
Content-Description: lpr.changelog
Content-Disposition: inline; filename="lpr.changelog"

2003-11-25  Rick Rankin <rick_rankin AT yahoo DOT com>

	* src/lpr/Printer.cc: fix bug in print() operation that was
	  causing duplication of the last character of a file.
	* src/lpr/lpr.cc: add description of -l option to help message.

--0-916528051-1069819986=:32174
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--0-916528051-1069819986=:32174--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019