File: uudecode

package info (click to toggle)
fig2dev 1:3.2.7a-5+deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,556 kB
  • sloc: ansic: 35,809; sh: 5,401; makefile: 177; perl: 13; csh: 12
file content (19 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl
#
# uudecode:
# got from /usr/doc/perl-5.005-doc/examples/uudecode.gz
#
while (<>) {
    next unless ($mode,$file) = /^begin\s*(\d*)\s*(\S*)/;
    open(OUT,"> $file") || die "Can't create $file: $!\n";
    while (<>) {
	    last if /^end/;
	    next if /[a-z]/;
	    next unless int((((ord() - 32) & 077) + 2) / 3) ==
		    int(length() / 4);
	    print OUT unpack("u", $_);
    }
    chmod oct($mode), $file;
    eof() && die "Missing end: $file may be truncated.\n";
}