diff options
-rw-r--r-- | GNUmakefile | 2 | ||||
-rw-r--r-- | man/mhdr.1 | 13 | ||||
-rw-r--r-- | mhdr.c | 16 |
3 files changed, 27 insertions, 4 deletions
diff --git a/GNUmakefile b/GNUmakefile index 9430a18..b8d70d4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -28,7 +28,7 @@ maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \ maddr magrep mexport mflag mgenmid mhdr mlist mpick mscan msed mseq mshow msort \ mthread : seq.o slurp.o maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o -magrep mflow mshow : rfc2045.o +magrep mflow mhdr mshow : rfc2045.o mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o mscan : pipeto.o msort : mystrverscmp.o diff --git a/man/mhdr.1 b/man/mhdr.1 index 3046e3b..f34d9b9 100644 --- a/man/mhdr.1 +++ b/man/mhdr.1 @@ -6,7 +6,7 @@ .Nd show mail headers .Sh SYNOPSIS .Nm -.Op Fl h Ar header +.Op Fl h Ar header Op Fl p Ar parameter .Op Fl d .Op Fl H .Op Fl M @@ -31,6 +31,10 @@ The options are as follows: .It Fl h Ar header Only print the values of the headers in the colon-separated list .Ar header . +.It Fl p Ar parameter +Extract a particular RFC 2045 +.Ar parameter +from the specified headers. .It Fl d Decode the headers according to RFC 2047. .It Fl H @@ -55,6 +59,13 @@ and >1 if an error occurs. .Rs .%A N. Freed .%A N. Borenstein +.%D November 1996 +.%R RFC 2045 +.%T Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies +.Re +.Rs +.%A N. Freed +.%A N. Borenstein .%B MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text .%R RFC 2047 .%D November 1996 diff --git a/mhdr.c b/mhdr.c index cc49c22..73d76f9 100644 --- a/mhdr.c +++ b/mhdr.c @@ -12,6 +12,7 @@ #include "blaze822.h" static char *hflag; +static char *pflag; static int Aflag; static int Dflag; static int Hflag; @@ -100,6 +101,16 @@ print_decode_header(char *s) void print_header(char *v) { + if (pflag) { + char *s, *se; + if (blaze822_mime_parameter(v, pflag, &s, &se)) { + *se = 0; + v = s; + } else { + return; + } + } + status = 0; if (Hflag && !Aflag) @@ -188,9 +199,10 @@ int main(int argc, char *argv[]) { int c; - while ((c = getopt(argc, argv, "h:ADHMd")) != -1) + while ((c = getopt(argc, argv, "h:p:ADHMd")) != -1) switch (c) { case 'h': hflag = optarg; break; + case 'p': pflag = optarg; break; case 'A': Aflag = 1; break; case 'D': Dflag = 1; break; case 'H': Hflag = 1; break; @@ -198,7 +210,7 @@ main(int argc, char *argv[]) case 'd': dflag = 1; break; default: fprintf(stderr, -"Usage: mhdr [-h header] [-d] [-H] [-M] [-A|-D] [msgs...]\n"); +"Usage: mhdr [-h header [-p parameter]] [-d] [-H] [-M] [-A|-D] [msgs...]\n"); exit(2); } |