[Pcre-svn] [537] code/trunk: Add newline in pcretest output …

Página Inicial
Delete this message
Autor: Subversion repository
Data:  
Para: pcre-svn
Assunto: [Pcre-svn] [537] code/trunk: Add newline in pcretest output if the last data line doesn't have one.
Revision: 537
          http://vcs.pcre.org/viewvc?view=rev&revision=537
Author:   ph10
Date:     2010-06-08 16:28:26 +0100 (Tue, 08 Jun 2010)


Log Message:
-----------
Add newline in pcretest output if the last data line doesn't have one.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcretest.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2010-06-07 16:39:32 UTC (rev 536)
+++ code/trunk/ChangeLog    2010-06-08 15:28:26 UTC (rev 537)
@@ -69,6 +69,9 @@
 17. Added a check for running out of memory when PCRE is compiled with
     --disable-stack-for-recursion (#990).


+18. If the last data line in a file for pcretest does not have a newline on
+    the end, a newline was missing in the output. 
+    



Version 8.02 19-Mar-2010

Modified: code/trunk/pcretest.c
===================================================================
--- code/trunk/pcretest.c    2010-06-07 16:39:32 UTC (rev 536)
+++ code/trunk/pcretest.c    2010-06-08 15:28:26 UTC (rev 537)
@@ -1786,7 +1786,11 @@
       {
       if (extend_inputline(infile, buffer + len, "data> ") == NULL)
         {
-        if (len > 0) break;
+        if (len > 0)    /* Reached EOF without hitting a newline */
+          {
+          fprintf(outfile, "\n"); 
+          break;
+          } 
         done = 1;
         goto CONTINUE;
         }
@@ -2081,7 +2085,7 @@
       }
     *q = 0;
     len = (int)(q - dbuffer);
-
+    
     /* Move the data to the end of the buffer so that a read over the end of
     the buffer will be seen by valgrind, even if it doesn't cause a crash. If
     we are using the POSIX interface, we must include the terminating zero. */