Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] missing run-mailcap
@ 2008-01-22 16:40 John Bent
  2008-01-22 22:33 ` John Bent
  0 siblings, 1 reply; 18+ messages in thread
From: John Bent @ 2008-01-22 16:40 UTC (permalink / raw)


I saw some earlier discussion in the list archives about a missing run-mailcap
script.  I had this same problem too on my mac (10.4.11 Power PC).  It's sort
of a kluge but I dealt with this by writing my own /usr/bin/run-mailcap which
just does a simple hash lookup of mime type to rename the file with an
appropriate extension and then uses the mac 'open' command.  I haven't fully
populated the hash table yet; I'll do that lazily.  If the 'file' command
could return an extension, I'd be tempted to use it and avoid the hash table
but the best it can do is return the mime-type which we already know.  Or if
there was some way to pass the mime-type to the 'open' command, that'd be
better too.  But at least this works...

===========================================================================

 
#! /usr/bin/perl

my %mimes = (
    'image/jpeg'    => 'jpg',
    'text/html'     => 'html',
);

my ( $type, $file ) = split( /:/, $ARGV[1] );
Log( "$type - $file\n" );
my $extension = $mimes{$type};
if ( ! defined $extension ) {
    Log( "Unknown type $type\n" );
} else {
    rename( $file, "$file.$extension" );
    Log( "open $file.$extension\n" );
    system( "open $file.$extension" );
}

#######################################################################

my $log_fd;
sub
Log {
    if ( ! defined $log_fd ) {
        open LOG, ">>/tmp/mailcap.log" or warn "open log: $!\n";
        $log_fd = \*LOG;
    }
    #print "@_";
    print LOG "@_";
}


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [sup-talk] missing run-mailcap
@ 2008-01-04 23:45 Giorgio Lando
  2008-01-04 23:59 ` Giorgio Lando
  2008-01-05  0:13 ` William Morgan
  0 siblings, 2 replies; 18+ messages in thread
From: Giorgio Lando @ 2008-01-04 23:45 UTC (permalink / raw)


A further problem: I am currently unable to convince sup to run my ~/.mailcap entries for attachment 
(the mimetypes is properly identified).

Grepping in the sup directory, I see that it uses a /usr/bin/run-mailcap. I have not this in my linux 
system (archlinux), and I guess that it is something debian specific (I have not in my freebsd, 
and I do not remember to have seen it in my slackware system - not sure of this).
I do not know how mailcap is used here (mutt resorts to it fine).

Do you know where I could find run-mailcap?
Giorgio Lando


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2008-02-03  3:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-22 16:40 [sup-talk] missing run-mailcap John Bent
2008-01-22 22:33 ` John Bent
2008-01-24 21:40   ` John Bent
2008-01-24 23:26     ` William Morgan
2008-01-24 23:52       ` John Bent
2008-01-25  0:17         ` William Morgan
2008-01-25  0:57           ` Grant Hollingworth
2008-01-25  4:40             ` John Bent
2008-01-26  0:35               ` John Bent
2008-01-30 17:29                 ` William Morgan
2008-01-30 17:54                   ` John Bent
2008-01-30 18:26                     ` William Morgan
2008-01-30 18:35                       ` John Bent
2008-02-03  3:01                         ` William Morgan
  -- strict thread matches above, loose matches on Subject: below --
2008-01-04 23:45 Giorgio Lando
2008-01-04 23:59 ` Giorgio Lando
2008-01-05  0:13 ` William Morgan
2008-01-05  1:01   ` Giorgio Lando

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox