Index: Dev/pukiwikiplus/getsource.pl
===================================================================
--- Dev/pukiwikiplus/getsource.pl	(revision 74f778c0eeed802c12174e0e6cff4851670e050d)
+++ Dev/pukiwikiplus/getsource.pl	(revision a1439aaec93e5fbdc5973c87763069cd24c4e4a5)
@@ -11,6 +11,11 @@
 
 if (@ARGV < 1) {
-    print "$0: url_to_pukiwikiplus_page\n";
+    print "$0: [-f] url_to_pukiwikiplus_page\n";
     exit;
+}
+
+my $file;
+if ($ARGV[0] eq '-f') {
+    $file = shift @ARGV;
 }
 
@@ -20,4 +25,7 @@
 if ($url !~ /cmd=source/ ) {
     $url =~ s#\?(.+)#\?cmd=source&page=$1#;
+    if ($file) {
+        $file = wikifile($1) . '.txt';
+    }
 }
 
@@ -31,3 +39,15 @@
 my $text = $source->scrape( URI->new($url) );
 
+if ($file) {
+    print STDERR "saving: '$file'\n";
+    open STDOUT, ">$file";
+}
 print encode('utf8', $text);
+
+
+sub wikifile {
+    my $pagename = shift @_;
+    
+    $pagename =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack('H2', $1)/eg;
+    return uc unpack("H*", $pagename);
+}
