Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / lib / 5.8.0 / CGI / eg / RunMeFirst
CommitLineData
86530b38
AT
1#!/usr/local/bin/perl
2
3# Make a world-writeable directory for saving state.
4$ww = 'WORLD_WRITABLE';
5unless (-w $ww) {
6 $u = umask 0;
7 mkdir $ww, 0777;
8 umask $u;
9}
10
11# Decode the sample image.
12for $uu (<*.uu>) {
13 unless (open UU, "<$uu") { warn "Can't open $uu: $!\n"; next }
14 while (<UU>) {
15 chomp;
16 if (/^begin\s+\d+\s+(.+)$/) {
17 $bin = $1;
18 last;
19 }
20 }
21 unless (open BIN, "> $bin") { warn "Can't create $bin: $!\n"; next }
22 binmode BIN;
23 while (<UU>) {
24 chomp;
25 last if /^end/;
26 print BIN unpack "u", $_;
27 }
28 close BIN;
29 close UU;
30}
31
32# Create symlinks from *.txt to *.cgi for documentation purposes.
33foreach (<*.cgi>) {
34 ($target = $_) =~ s/cgi$/txt/i;
35 symlink $_, $target unless -e $target;
36}