git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] send-email: Fix Pine address book parsing

From
TPTrent Piepho <tpiepho@freescale.com>
Date
Nov 26, 2008, 02:55 UTC
Message-ID
<1227668100-5563-1-git-send-email-tpiepho@freescale.com>
See:  http://www.washington.edu/pine/tech-notes/low-level.html

Entries with a fcc or comment field after the address weren't parsed correctly.

Continuation lines, identified by leading spaces, were also not handled.

Distribution lists which had ( ) around a list of addresses did not have the parenthesis removed.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
---
 git-send-email.perl |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 94ca5c8..007e2c6 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -345,10 +345,13 @@ my %parse_alias = (
 			# spaces delimit multiple addresses
 			$aliases{$1} = [ split(/\s+/, $2) ];
 		}}},
-	pine => sub { my $fh = shift; while (<$fh>) {
-		if (/^(\S+)\t.*\t(.*)$/) {
+	pine => sub { my $fh = shift; my $f='\t[^\t]*';
+	        for (my $x = ''; defined($x); $x = $_) {
+			chomp $x;
+		        $x .= $1 while(defined($_ = <$fh>) && /^ +(.*)$/);
+			$x =~ /^(\S+)$f\t\(?([^\t]+?)\)?(:?$f){0,2}$/ or next;
 			$aliases{$1} = [ split(/\s*,\s*/, $2) ];
-		}}},
+		}},
 	gnus => sub { my $fh = shift; while (<$fh>) {
 		if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
 			$aliases{$1} = [ $2 ];
-- 
1.5.4.1
Next: Junio C Hamano
Message 1 of 6 in “send-email: Fix Pine address book parsing”
  1. send-email: Fix Pine address book parsingTrent Piepho, Nov 26, 2008
  2. Junio C HamanoNov 26, 2008
  3. Trent PiephoNov 26, 2008
  4. Junio C HamanoNov 26, 2008
  5. Trent PiephoNov 26, 2008
  6. Junio C HamanoNov 26, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.