]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Backslash-escape `-'s in email addresses, so that they are
authorJim Meyering <jim@meyering.net>
Sun, 14 Nov 2004 09:48:05 +0000 (09:48 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 14 Nov 2004 09:48:05 +0000 (09:48 +0000)
rendered properly in UTF-locales.

(escape_hyphens): New function.
(main): Call it on email addresses.

man/help2man

index a0f1be039a05b5b24c9089f83694cba84e21c2c2..e8ea7185486d3317535edf33f6e2c6f753db75b0 100755 (executable)
@@ -46,6 +46,13 @@ BEGIN {
     }
 }
 
+sub escape_hyphens($)
+{
+  my ($s) = @_;
+  $s =~ s/-/\\-/g;
+  return $s;
+}
+
 sub _ { gettext @_ }
 sub N_ { $_[0] }
 
@@ -599,6 +606,9 @@ for my $sect (@pre, (grep ! /^($filter)$/o, @include), @post)
            # Convert some latin1 chars to troff equivalents
            s/\xa0/\\ /g; # non-breaking space
 
+           # Escape hyphens in <>-enclosed email addresses.
+           s/(<\S+\@(\S+\.)+\S{2,}>)/escape_hyphens $1/ge;
+
            print;
        }
     }