ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/example-decoder
(Generate patch)

Comparing Convert-UUlib/example-decoder (file contents):
Revision 1.21 by root, Tue Dec 14 21:19:33 2010 UTC vs.
Revision 1.24 by root, Fri Feb 28 16:57:25 2020 UTC

1#!/usr/bin/perl 1#!/usr/bin/perl
2 2
3# decode all the files in the directory uusrc/ and copy 3# decode all the files in the directory uusrc/ and copy
4# the resulting files to uudst/ 4# the resulting files to uudst/
5
6#use Coro::Multicore;
7
8use strict;
5 9
6use Convert::UUlib ':all'; 10use Convert::UUlib ':all';
7 11
8sub namefilter { 12sub namefilter {
9 my ($path) = @_; 13 my ($path) = @_;
85Smerge -1; 89Smerge -1;
86 90
87SetOption OPT_SAVEPATH, "uudst/"; 91SetOption OPT_SAVEPATH, "uudst/";
88 92
89# now wade through all files and their source parts 93# now wade through all files and their source parts
90$i = 0; 94for my $uu (GetFileList) {
91while ($uu = GetFileListItem $i) { 95 print "file ", $uu->filename, "\n";
92 $i++;
93 print "file nr. $i";
94 print " state ", $uu->state; 96 print " state ", $uu->state, "\n";
95 print " mode ", $uu->mode; 97 print " mode ", $uu->mode, "\n";
96 print " uudet ", strencoding $uu->uudet; 98 print " uudet ", strencoding $uu->uudet, "\n";
97 print " size ", $uu->size; 99 print " size ", $uu->size, "\n";
98 print " filename ", $uu->filename;
99 print " subfname ", $uu->subfname; 100 print " subfname ", $uu->subfname, "\n";
100 print " mimeid ", $uu->mimeid; 101 print " mimeid ", $uu->mimeid, "\n";
101 print " mimetype ", $uu->mimetype; 102 print " mimetype ", $uu->mimetype, "\n";
102 print "\n";
103 103
104 # print additional info about all parts 104 # print additional info about all parts
105 print " parts";
105 for ($uu->parts) { 106 for ($uu->parts) {
106 while (my ($k, $v) = each %$_) { 107 for my $k (sort keys %$_) {
107 print "$k > $v, "; 108 print " $k=$_->{$k}";
108 } 109 }
109 print "\n"; 110 print "\n";
110 } 111 }
111 112
112 print $uu->filename;
113
114 $uu->remove_temp; 113 $uu->remove_temp;
115 114
116 print "<s", $uu->state, ">";#d#
117 if (my $err = $uu->decode) { 115 if (my $err = $uu->decode) {
118 print ", ", strerror $err, "\n"; 116 print " ERROR ", strerror $err, "\n";
119 } else { 117 } else {
120 print ", saved as uudst/", $uu->filename, "\n"; 118 print " successfully saved as uudst/", $uu->filename, "\n";
121 } 119 }
122} 120}
123 121
124print "cleanup...\n"; 122print "cleanup...\n";
125 123

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines