0
|
1 #!/usr/bin/perl
|
|
2
|
16
|
3 my @A = ();
|
|
4 my $i = 0;
|
|
5 my $tmp = "/tmp/postaa$$";
|
|
6 my $host = "yourhost.cr.ie.u-ryukyu.ac.jp";
|
|
7 my $f;
|
|
8 my $file;
|
|
9 my @U;
|
|
10 my $debug = 0;
|
|
11
|
|
12 if ($debug) {
|
|
13 open(LOG,">>/tmp/postcnv.log");
|
|
14 }
|
|
15
|
|
16 sub mysystem {
|
|
17 my ($arg) = @_;
|
|
18 print LOG "$arg\n" if ($debug);
|
|
19 system $arg;
|
|
20 }
|
|
21
|
|
22 # system "echo @ARGV >> /tmp/ahoaho";
|
0
|
23
|
|
24 # /usr/local/mh/lib/post [-alias aliasfile]
|
|
25 # [-filter filterfile] [-nofilter] [-format] [-noformat]
|
|
26 # [-mime] [-nomime] [-msgid] [-nomsgid] [-verbose]
|
|
27 # [-noverbose] [-watch] [-nowatch] [-width columns] file
|
|
28 # [-help]
|
|
29
|
|
30 while ( @ARGV ) {
|
|
31 $_ = shift(@ARGV);
|
|
32 # options require argument
|
|
33 if( /^-alias/ ) {
|
|
34 push(@A,$_); $_ = shift(@ARGV); push(@A,$_);
|
|
35 } elsif( /^-filter/ ) {
|
|
36 push(@A,$_); $_ = shift(@ARGV); push(@A,$_);
|
|
37 } elsif( /^-idanno/ ) {
|
16
|
38 shift(@ARGV);
|
|
39 # push(@A,$_); $_ = shift(@ARGV); push(@A,$_);
|
0
|
40 } elsif( /^-library/ ) {
|
|
41 push(@A,$_); $_ = shift(@ARGV); push(@A,$_);
|
|
42 } elsif( /^-width/ ) {
|
|
43 push(@A,$_); $_ = shift(@ARGV); push(@A,$_);
|
|
44 } elsif( /^-/ ) {
|
16
|
45 push(@A,$_);
|
0
|
46 } else {
|
|
47 $f = $tmp . $i++;
|
16
|
48 $file = $_;
|
|
49 push(@A,$f); # push(@U,$_);
|
0
|
50 }
|
|
51 }
|
|
52
|
16
|
53 # system "refile -link -src +drafts last +send";
|
|
54 # print STDERR "/bin/cp $f $new\n";
|
|
55 if ($file) {
|
|
56 my $new = `/usr/local/mh/bin/mhpath +send new`;
|
|
57 # system("nkf -j -m0 --overwrite $file"); too late?
|
|
58 mysystem("/bin/cp $file $new");
|
|
59 mysystem("scp $file ${host}:${f}");
|
|
60 }
|
0
|
61
|
16
|
62 # system "echo remote @A >> /tmp/ahoaho";
|
|
63 # how to handle error?
|
|
64 mysystem("ssh $host /usr/local/mh/lib/post @A");
|
0
|
65
|
16
|
66 if (! $debug) {
|
|
67 mysystem("ssh $host rm $f");
|
|
68 }
|
|
69
|
|
70 # unlink(@U);
|
|
71 1;
|
|
72
|
|
73 #end
|