summaryrefslogtreecommitdiff
path: root/eg/uudecode
diff options
context:
space:
mode:
authorLarry Wall <larry@netlabs.com>1993-10-10 00:00:00 +0000
committerLarry Wall <larry@netlabs.com>1993-10-10 00:00:00 +0000
commit93a17b20b6d176db3f04f51a63b0a781e5ffd11c (patch)
tree764149b1d480d5236d4d62b3228bd57f53a71042 /eg/uudecode
parent79072805bf63abe5b5978b5928ab00d360ea3e7f (diff)
downloadperl-93a17b20b6d176db3f04f51a63b0a781e5ffd11c.tar.gz
perl 5.0 alpha 3
[editor's note: the sparc executables have not been included, and emacs backup files have been removed]
Diffstat (limited to 'eg/uudecode')
-rw-r--r--eg/uudecode15
1 files changed, 15 insertions, 0 deletions
diff --git a/eg/uudecode b/eg/uudecode
new file mode 100644
index 0000000000..3b3cb60a23
--- /dev/null
+++ b/eg/uudecode
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+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";
+}
+