This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

CygUtils patch for last char repeat bug in lpr


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
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"
2003-11-25  Rick Rankin <rick_rankin@yahoo.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.
--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]