Commit | Line | Data |
54310121 |
1 | #!/usr/local/bin/perl |
2 | |
3 | # Make a world-writeable directory for saving state. |
4 | $ww = 'WORLD_WRITABLE'; |
5 | unless (-w $ww) { |
6 | $u = umask 0; |
7 | mkdir $ww, 0777; |
8 | umask $u; |
9 | } |
10 | |
11 | # Decode the sample image. |
424ec8fa |
12 | for $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 | } |
54310121 |
21 | unless (open BIN, "> $bin") { warn "Can't create $bin: $!\n"; next } |
424ec8fa |
22 | binmode BIN; |
54310121 |
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. |
33 | foreach (<*.cgi>) { |
424ec8fa |
34 | ($target = $_) =~ s/cgi$/txt/i; |
54310121 |
35 | symlink $_, $target unless -e $target; |
36 | } |