]> granicus.if.org Git - curl/commitdiff
mkhelp: Remove trailing carriage return from every line of input
authorJay Satiro <raysatiro@yahoo.com>
Wed, 18 Mar 2015 05:44:48 +0000 (01:44 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 18 Mar 2015 12:48:36 +0000 (13:48 +0100)
- Get rid of this flood of warnings in Windows mingw build:
warning: missing terminating " character

The warning is due to the carriage return. When msysgit checks out files
from the repo by default it converts the line endings to CRLF. Prior to
this change when mkhelp.pl processed the MANUAL and curl.1 in CRLF
format the trailing carriage returns caused unnecessary CR in the
output.

src/mkhelp.pl

index 7ed86f7cd784e354dda8953167a4bff96fee68da..088a09a06a13d258aedef1ef792272549925599b 100644 (file)
@@ -54,6 +54,9 @@ while (<STDIN>) {
     # this should be removed:
     $line =~ s/(\b.|_\b)//g;
 
+    # remove trailing CR from line. msysgit checks out files as line+CRLF
+    $line =~ s/\r$//;
+
     if($line =~ /^([ \t]*\n|curl)/i) {
         # cut off headers and empty lines
         $wline++; # count number of cut off lines
@@ -90,7 +93,12 @@ open(READ, "<$README") ||
     die "couldn't read the README infile $README";
 
 while(<READ>) {
-    push @out, $_;
+    my $line = $_;
+
+    # remove trailing CR from line. msysgit checks out files as line+CRLF
+    $line =~ s/\r$//;
+
+    push @out, $line;
 }
 close(READ);