mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit edf4458016077547b7e76b79971f86f19fbd1819
parent cfec8ca377ba57b0e0638b9b7ae980c5ff2e6c41
Author: Christian Neukirchen <chneukirchen@gmail.com>
Date:   Tue,  9 Aug 2016 15:49:46 +0200

maddr: -a to only print address part

Diffstat:
maddr.c | 13++++++++++---
man/maddr.1 | 3+++
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/maddr.c b/maddr.c @@ -8,6 +8,7 @@ #include "blaze822.h" +static int aflag; static char defaulthflags[] = "from:sender:reply-to:to:cc:bcc:" "resent-from:resent-sender:resent-to:resent-cc:resent-bcc:"; static char *hflag = defaulthflags; @@ -40,7 +41,11 @@ addr(char *file) sizeof dispdec - 1, "UTF-8"); dispdec[sizeof dispdec - 1] = 0; - printf("%s <%s>\n", dispdec, addr); + if (aflag) + printf("%s\n", addr); + else + printf("%s <%s>\n", + dispdec, addr); } else if (addr) { printf("%s\n", addr); } @@ -59,11 +64,13 @@ int main(int argc, char *argv[]) { int c; - while ((c = getopt(argc, argv, "h:")) != -1) + while ((c = getopt(argc, argv, "ah:")) != -1) switch(c) { + case 'a': aflag = 1; break; case 'h': hflag = optarg; break; default: - fprintf(stderr, "Usage: maddr [-h headers] [msgs...]\n"); + fprintf(stderr, + "Usage: maddr [-a] [-h headers] [msgs...]\n"); exit(1); } diff --git a/man/maddr.1 b/man/maddr.1 @@ -6,6 +6,7 @@ .Nd extract mail addresses from messages .Sh SYNOPSIS .Nm +.Op Fl a .Op Fl h Ar headers .Op Ar msgs\ ... .Sh DESCRIPTION @@ -33,6 +34,8 @@ will read filenames from standard input. .Pp The options are as follows: .Bl -tag -width Ds +.It Fl a +Only print the address part of the address, not the display name. .It Fl h Ar headers Only search the colon-separated list of .Ar headers