X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-send-email.perl;h=449d938ba97cf1db47049a2f514bea1ed220044b;hb=ce2c3ebbc5a66e0370b3ab5b5611c2c390ddd6c0;hp=6adb66947279e290d90be7da154f49e696894528;hpb=e636799b4d6a6a8abad151697eae27044bb8e95b;p=git.git diff --git a/git-send-email.perl b/git-send-email.perl index 6adb66947..449d938ba 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -20,6 +20,7 @@ use strict; use warnings; use Term::ReadLine; use Getopt::Long; +use Text::ParseWords; use Data::Dumper; use Term::ANSIColor; use Git; @@ -38,7 +39,7 @@ package main; sub usage { print <... +git send-email [options] ... Options: --from Specify the "From:" line of the email to be sent. @@ -363,6 +364,10 @@ foreach my $entry (@bcclist) { die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/; } +sub split_addrs { + return parse_line('\s*,\s*', 1, @_); +} + my %aliases; my %parse_alias = ( # multiline formats can be supported in the future @@ -371,7 +376,7 @@ my %parse_alias = ( my ($alias, $addr) = ($1, $2); $addr =~ s/#.*$//; # mutt allows # comments # commas delimit multiple addresses - $aliases{$alias} = [ split(/\s*,\s*/, $addr) ]; + $aliases{$alias} = [ split_addrs($addr) ]; }}}, mailrc => sub { my $fh = shift; while (<$fh>) { if (/^alias\s+(\S+)\s+(.*)$/) { @@ -380,7 +385,7 @@ my %parse_alias = ( }}}, pine => sub { my $fh = shift; while (<$fh>) { if (/^(\S+)\t.*\t(.*)$/) { - $aliases{$1} = [ split(/\s*,\s*/, $2) ]; + $aliases{$1} = [ split_addrs($2) ]; }}}, gnus => sub { my $fh = shift; while (<$fh>) { if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) { @@ -407,10 +412,9 @@ for my $f (@ARGV) { push @files, grep { -f $_ } map { +$f . "/" . $_ } sort readdir(DH); - + closedir(DH); } elsif (-f $f or -p $f) { push @files, $f; - } else { print STDERR "Skipping $f - not found.\n"; } @@ -459,7 +463,7 @@ if (!@to) { } my $to = $_; - push @to, split /,\s*/, $to; + push @to, split_addrs($to); $prompting++; } @@ -882,7 +886,7 @@ foreach my $t (@files) { } elsif (/^Content-type:/i) { $has_content_type = 1; - if (/charset="?[^ "]+/) { + if (/charset="?([^ "]+)/) { $body_encoding = $1; } push @xh, $_;