#!/usr/bin/perl

if ( $#ARGV == -1 ) {
    print "Enter attaching file name: ";
    open(TTY,"</dev/tty");
    $| = 1; $| = 0;
    $ARGV[0] = <TTY>;
}

print "#<text/plain;charset=iso-2022-jp;encoding=7bit\n\n";

foreach ( @ARGV ) {
    /\.[^.]*$/;   $suffix = $&;
    if ($suffix =~ /.gif/i) {
          print "#image/gif;"
    } elsif ($suffix =~ /.jpg/i) {
          print "#image/jpeg;"
    } elsif ($suffix =~ /.jpeg/i) {
          print "#image/jpeg;"
    } elsif ($suffix =~ /.au/i) {
          print "#audio/basic;"
    } elsif ($suffix =~ /.pdf/i) {
          print "#application/pdf;"
    } elsif ($suffix =~ /.ps/i) {
          print "#image/postscript;"
    } elsif ($suffix =~ /.eps/i) {
          print "#image/postscript;"
    } elsif ($suffix =~ /.idraw/i) {
          print "#image/postscript;"
    } elsif ($suffix =~ /.gpg/i) {
          print "#application/pgp-encrypted;"
    } elsif ($suffix =~ /.text/i) {
          print "#text/plain;"
    } elsif ($suffix =~ /.txt/i) {
          print "#text/plain;"
    } elsif ($suffix =~ /.rtf/i) {
          print "#application/msword;"
    } elsif ($suffix =~ /.graffle/i) {
          print "#application/omnigraffle;"
    } elsif ($suffix =~ /.doc/i) {
          print "#application/msword;"
    } elsif ($suffix =~ /.msword/i) {
          print "#application/msword;"
    } elsif ($suffix =~ /.mm/i) {
          print "#application/FreeMind;"
    } elsif ($suffix =~ /.vcs/i) {
          print "#text/x-vcalendar;"
    } elsif ($suffix =~ /.vcf/i) {
          print "#text/x-vcard;"
    } elsif ($suffix =~ /.xls/i) {
          print "#application/vnd.ms-excel;"
    } elsif ($suffix =~ /.html/i) {
          print "#application/html;"
    } 
    my $file = $_;
    s-.*/--;
    print "name=$_ $file\n";
}

#end
