-.TH MAILCAP 4 "Release 2" "Bellcore Prototype"
+.\" Hey, Emacs! This is an -*- nroff -*- source file.
+.TH MAILCAP 5 "Release 2" "Bellcore Prototype"
.SH NAME
mailcap - metamail capabilities file
.SH DESCRIPTION
can be used to indicate that the output of the 'cat' command may be voluminous, requiring either a scrolling window, a pager, or some other appropriate coping mechanism.
-The "type" field (text/plain, in the above example) is simply any legal content type name, as defined by RFC 822. In practice, this is almost any string. It is the string that will be matched against the "Content-type" header (or the value passed in with -c) to decide if this is the mailcap entry that matches the current message. Additionally, the type field may specify a subtype (e.g. "text/ISO-8859-1") or a wildcard to match all subtypes (e.g. "image/*").
+The "type" field (text/plain, in the above example) is simply any legal content type name, as defined by informational RFC 1524. In practice, this is almost any string. It is the string that will be matched against the "Content-type" header (or the value passed in with -c) to decide if this is the mailcap entry that matches the current message. Additionally, the type field may specify a subtype (e.g. "text/ISO-8859-1") or a wildcard to match all subtypes (e.g. "image/*").
-The "command" field is any UNIX command ("cat %s" in the above example), and is used to specify the interpreter for the given type of message. It will be passed to the shell via the system(3) facility. Semicolons and backslashes within the command must be quoted with backslashes. If the command contains "%s", those two characters will be replaced by the name of a file that contains the body of the message. If it contains "%t', those two characters will be replaced by the content-type field, including the subtype, if any. (That is, if the content-type was "image/pbm; opt1=something-else", then "%t" would be replaced by "image/pbm".) If the command field contains "%{" followed by a parameter name and a closing "}", then all those characters will be replaced by the value of the named parameter, if any, from the Content-type header. Thus, in the previous example, "%{opt1}" will be replaced by "something-else". Finally, if the command contains "\%", those two characters will be replaced by a single % ch
-
-
-
-aracter. (In fact, the backslash can be used to quote any character, including itself.)
+The "command" field is any UNIX command ("cat %s" in the above example), and is used to specify the interpreter for the given type of message. It will be passed to the shell via the system(3) facility. Semicolons and backslashes within the command must be quoted with backslashes. If the command contains "%s", those two characters will be replaced by the name of a file that contains the body of the message. If it contains "%t", those two characters will be replaced by the content-type field, including the subtype, if any. (That is, if the content-type was "image/pbm; opt1=something-else", then "%t" would be replaced by "image/pbm".) If the command field contains "%{" followed by a parameter name and a closing "}", then all those characters will be replaced by the value of the named parameter, if any, from the Content-type header. Thus, in the previous example, "%{opt1}" will be replaced by "something-else". Finally, if the command contains "\\%", those two characters will be replaced by a single % character. (In fact, the backslash can be used to quote any character, including itself.)
If no "%s" appears in the command field, then instead of placing the message body in a temporary file, metamail will pass the body to the command on the standard input. This is helpful in saving /tmp file space, but can be problematic for window-oriented applications under some window systems such as MGR.
.SH BUILT-IN CONTENT-TYPE SUPPORT
The metamail program has built-in support for a few key content-types. In particular, it supports the text type, the multipart and multipart/alternative type, and the message/rfc822 types. This support is incomplete for many subtypes -- for example, it only supports US-ASCII text in general. This kind of built-in support can be OVERRIDDEN by an entry in any mailcap file on the user's search path. Metamail also has rudimentary built-in support for types that are totally unrecognized -- i.e. for which no mailcap entry or built-in handler exists. For such unrecognized types, metamail will write a file with a "clean" copy of the data -- i.e. a copy in which all mail headers have been removed, and in which any 7-bit transport encoding has been decoded.
.SH FILES
-$HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap -- default path for mailcap files.
+$HOME/.mailcap:/etc/mailcap:/usr/share/etc/mailcap:/usr/local/etc/mailcap -- default path for mailcap files.
.SH SEE ALSO
-metamail(1)
+.BR run-mailcap "(1)",
+.BR update-mime-database "(1)"
.SH COPYRIGHT
Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
Summary(tr.UTF-8): Çeşitli programlar için çokluortam yardımcı uygulamaları tanımlar
Name: mailcap
Version: 2.3
-Release: 3
+Release: 4
License: Public Domain
Group: Base
Source0: https://fedorahosted.org/released/mailcap/mailcap-%{fcver}.tar.gz
$debug=0;
+$norun=0;
+$pager=0;
$etcmimetyp="/etc/mime.types";
$shrmimetyp="/usr/share/etc/mime.types";
$locmimetyp="/usr/local/etc/mime.types";
print STDERR "Options:\n";
print STDERR " action specify what action to do on these files (default=view)\n";
print STDERR " debug be verbose about what's going on\n";
+ print STDERR " pager ignore any \"copiousoutput\" directives and use a \"pager\"\n";
+ print STDERR " norun just print but don't execute the command (useful with --debug)\n";
print STDERR "\n";
print STDERR "Mime-Type:\n";
print STDERR " any standard mime type designation in the form <class>/<subtype> -- if\n";
unless ($action) {
if ($0 =~ m!(^|/)view$!) { $action="view"; }
elsif ($0 =~ m!(^|/)see$!) { $action="view"; }
+ elsif ($0 =~ m!(^|/)cat$!) { $action="cat"; }
elsif ($0 =~ m!(^|/)edit$!) { $action="edit"; }
elsif ($0 =~ m!(^|/)change$!) { $action="edit"; }
elsif ($0 =~ m!(^|/)compose$!) { $action="compose";}
$_ = "\Q$1\E"; s/\\\*/\.\*/g;
push @matches,$entry if ($type =~ m!^$_$!i);
}
- @matches = grep(/\Q$action\E=/,@matches) unless $action eq "view";
+ @matches = grep(/\Q$action\E=/,@matches) unless ($action eq "view" || $action eq "cat");
my $done=0;
my $fail=0;
foreach $match (@matches) {
my $comm;
print STDERR " - checking mailcap entry \"$match\"\n" if $debug;
- if ($action eq "view") {
+ if ($action eq "view" || $action eq "cat") {
($comm) = ($match =~ m/^.*?;\s*(.*?)\s*($|;)/);
} else {
($comm) = ($match =~ m/\Q$action\E=(.*?)\s*($|;)/);
next if (!$comm || $comm =~ m!(^|/)false$!i);
print STDERR " - program to execute: $comm\n" if $debug;
- if ($match =~ m/;\s*test=(.*?)\s*($|;)/) {
- my $test;
- print STDERR " - running test: $1 " if $debug;
- $test = system "$1 >/dev/null 2>&1";
- $test >>= 8;
- print STDERR " (result=$test=",($test!=0?"false":"true"),")\n" if $debug;
- if ($test) {
- $fail++;
- next;
- }
- }
+ if ($action eq 'cat' && $match !~ m/;\s*copiousoutput\s*($|;)/) {
+ print STDERR " - \"copiousoutput\" is required for \"cat\" action\n" if $debug;
+ $fail++;
+ next;
+ }
my($tmpfile,$tmplink);
if ($action ne 'print' && $match =~ m/;\s*needsterminal\s*($|;)/ && ! -t STDOUT) {
$fail++;
next;
}
+ } elsif ($action eq 'view' && $pager && $match =~ m/;\s*copiousoutput\s*($|;)/ && $type ne 'text/plain') {
+ $comm .= " | $0 --action=$action text/plain:-";
+ }
+
+ if ($match =~ m/;\s*test=(.*?)\s*($|;)/) {
+ my $test;
+ print STDERR " - running test: $1 " if $debug;
+ $test = system "$1 >/dev/null 2>&1";
+ $test >>= 8;
+ print STDERR " (result=$test=",($test!=0?"false":"true"),")\n" if $debug;
+ if ($test) {
+ $fail++;
+ next;
+ }
}
if ($file ne "-") {
$comm =~ s!$quotedprct!%!go;
print STDERR " - executing: $comm\n" if $debug;
- $res = system $comm;
- $res = int($res/256);
+ if ($norun) {
+ print $comm,"\n";
+ $res = 0;
+ } else {
+ $res = system $comm;
+ $res = int($res/256);
+ }
if ($res != 0) {
print STDERR "Warning: program returned non-zero exit code \#$res\n";
$retcode = $res;
file
.SH SYNOPSIS
.B run-mailcap
-\-\-action=ACTION [\-\-debug]
+\-\-action=ACTION [\-\-option[=value]]
[MIME-TYPE:[ENCODING:]]FILE [...]
The
.BI \-\-action=<action>
Performs the specified action on the files. Valid actions are
.IR view ,
+.IR cat
+(like view but never paged) ,
.IR compose ,
.IR composetyped ,
.I edit
If no action is specified, the action will be determined by how the
program was called.
.TP
-.BI \-\-debug=<value>
-Turns on extra information to find out what is happening. Any value
-other than zero (0) will turn on debugging output.
+.BI \-\-debug
+Turns on extra information to find out what is happening.
+.TP
+.BI \-\-nopager
+Ignores any "copiousoutput" directive and sends output to STDOUT.
+.TP
+.BI \-\-norun
+Displays the found command without actually executing it.
.SH "SEE ALSO"
.BR update-mime "(8)"
.SH AUTHOR