summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/eg/uudecode
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-08-19 10:13:38 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-08-19 10:13:38 +0000
commit14856225739aa48b6c9cf4c17925362b2d95cea3 (patch)
treedfd38f1b654fb5bbdfc38887c1a829b658e71530 /gnu/usr.bin/perl/eg/uudecode
parent77469082517e44fe6ca347d9e8dc7dffd1583637 (diff)
Import of Perl 5.003 into the tree. Makefile.bsd-wrapper and
config.sh.OpenBSD are the only local changes.
Diffstat (limited to 'gnu/usr.bin/perl/eg/uudecode')
-rw-r--r--gnu/usr.bin/perl/eg/uudecode15
1 files changed, 15 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/eg/uudecode b/gnu/usr.bin/perl/eg/uudecode
new file mode 100644
index 00000000000..3b3cb60a234
--- /dev/null
+++ b/gnu/usr.bin/perl/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";
+}
+