Initial Commit
[packages] / xemacs-packages / mew / mew / bin / uumerge.in
1 #!@PERL@
2
3 ### uumerge --- merging split uu files for Mew
4
5 ### Code:
6
7 require 'getopt.pl';
8 &Getopt('d:');
9
10 if ($opt_d) {
11         chdir($opt_d) || die "$opt_d: $!\n";
12 }
13
14 while (<>) {
15         $sawbegin++, last if ($mode,$file) = /^begin\s*(\d*)\s*(\S*)/;
16 }
17 die "uumerge: missing begin\n" unless $sawbegin;
18 open(OUT,"> $file") if $file ne "";
19 binmode(OUT);
20 while (<>) {
21         $sawend++, last if /^end/;
22         s/[a-z]+$//; # handle stupid trailing lowercase letters
23         next if /[a-z]/;
24         next unless int((((ord() - 32) & 077) + 2) / 3) == int(length() / 4);
25         print OUT unpack("u", $_);
26 }
27 close(OUT);
28 chmod oct($mode), $file;
29 die "uumerge: missing end\n" unless $sawend;
30
31 print $file, "\n";
32 exit 0;
33
34 ## Copyright (C) 1994, 1995, 1996, 1997 Mew developing team.
35 ## All rights reserved.
36 ## 
37 ## Redistribution and use in source and binary forms, with or without
38 ## modification, are permitted provided that the following conditions
39 ## are met:
40 ## 
41 ## 1. Redistributions of source code must retain the above copyright
42 ##    notice, this list of conditions and the following disclaimer.
43 ## 2. Redistributions in binary form must reproduce the above copyright
44 ##    notice, this list of conditions and the following disclaimer in the
45 ##    documentation and/or other materials provided with the distribution.
46 ## 3. Neither the name of the team nor the names of its contributors
47 ##    may be used to endorse or promote products derived from this software
48 ##    without specific prior written permission.
49 ## 
50 ## THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
51 ## ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53 ## PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
54 ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
55 ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
56 ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
57 ## BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
58 ## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
59 ## OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
60 ## IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61
62 ### uumerge ends here