cvsdist f230132
diff -ruN man-pages-ja-20011115.orig/script/configure.perl man-pages-ja-20011115/script/configure.perl
cvsdist f230132
--- man-pages-ja-20011115.orig/script/configure.perl	2002-06-07 01:51:46.000000000 +0900
cvsdist f230132
+++ man-pages-ja-20011115/script/configure.perl	2002-06-07 01:52:02.000000000 +0900
cvsdist f230132
@@ -1,4 +1,5 @@
cvsdist f230132
 #!/usr/bin/perl
cvsdist f230132
+use IO::Handle;
cvsdist f230132
 use Env qw (PATH LANG);
cvsdist f230132
 use strict 'vars';
cvsdist f230132
 
cvsdist f230132
@@ -11,6 +12,13 @@
cvsdist f230132
 my $PKGLIST = "script/pkgs.list";
cvsdist f230132
 my @pack_method = ("none", "gzip", "bzip2", "compress");
cvsdist f230132
 my $podsec = "1";
cvsdist f230132
+my @stdin;
cvsdist f230132
+my $pipeflag = 0;
cvsdist f230132
+
cvsdist f230132
+if ( -p STDIN ) {
cvsdist f230132
+    $pipeflag = 1;
cvsdist f230132
+    @stdin = STDIN->getlines;
cvsdist f230132
+}
cvsdist f230132
 
cvsdist f230132
 #
cvsdist f230132
 # インストール情報
cvsdist f230132
@@ -21,7 +29,7 @@
cvsdist f230132
 do{
cvsdist f230132
     $MANROOT = "/usr/man/$LANG";
cvsdist f230132
     print "   Install directory   [$MANROOT] ?: ";
cvsdist f230132
-    $ans = <STDIN>; chomp $ans;
cvsdist f230132
+    $ans = &get_from_stdin; chomp $ans;
cvsdist f230132
     if ($ans ne "") {$MANROOT = $ans;}
cvsdist f230132
 
cvsdist f230132
     print "   compress manual with..\n";
cvsdist f230132
@@ -29,19 +37,19 @@
cvsdist f230132
 	print "      $i: $pack_method[$i]\n";
cvsdist f230132
     }
cvsdist f230132
     print "   select [0..$#pack_method] : ";
cvsdist f230132
-    $ans = <STDIN>; chomp $ans;
cvsdist f230132
+    $ans = &get_from_stdin; chomp $ans;
cvsdist f230132
     if  ($ans eq "") {$ans = 0;}
cvsdist f230132
     if ($ans < 0 || $ans > $#pack_method) {$PACK = $pack_method[0]}
cvsdist f230132
     else {$PACK = $pack_method[$ans]}
cvsdist f230132
 
cvsdist f230132
     $OWNER = "root";
cvsdist f230132
     print "   uname of page owner [$OWNER] ?: ";
cvsdist f230132
-    $ans = <STDIN>; chomp $ans;
cvsdist f230132
+    $ans = &get_from_stdin; chomp $ans;
cvsdist f230132
     if ($ans ne "") {$OWNER = $ans;}
cvsdist f230132
 
cvsdist f230132
     $GROUP = "root";
cvsdist f230132
     print "   group of page owner [$GROUP] ?: ";
cvsdist f230132
-    $ans = <STDIN>; chomp $ans;
cvsdist f230132
+    $ans = &get_from_stdin; chomp $ans;
cvsdist f230132
     if ($ans ne "") {$GROUP = $ans;}
cvsdist f230132
 
cvsdist f230132
     print "\n";
cvsdist f230132
@@ -51,7 +59,7 @@
cvsdist f230132
     print "\n";
cvsdist f230132
     do {
cvsdist f230132
 	print "All OK? (Yes, [C]ontinue / No, [R]eselect) : ";
cvsdist f230132
-	$ans = <STDIN>; chomp $ans;
cvsdist f230132
+	$ans = &get_from_stdin; chomp $ans;
cvsdist f230132
     } until ($ans =~ /^[yYnNcCrR]/);
cvsdist f230132
 
cvsdist f230132
 } until ($ans =~ /^[yYcC]/);
cvsdist f230132
@@ -90,14 +98,14 @@
cvsdist f230132
     for $i (0 .. $#pl){
cvsdist f230132
 	my $qstr = ($main::pw{$pl[$i]} > -1) ? "[Y/n]" : "[y/N]";
cvsdist f230132
 	printf "   [%2d/%2d] %-15s %s ?: ", $i, $#pl, $pl[$i], $qstr;
cvsdist f230132
-	$ans = <STDIN>; chomp $ans;
cvsdist f230132
+	$ans = &get_from_stdin; chomp $ans;
cvsdist f230132
 	if ($ans =~ /[Yy].*/) { $main::pw{$pl[$i]} = $i;}
cvsdist f230132
 	if ($ans =~ /[Nn].*/) { $main::pw{$pl[$i]} = -1;}
cvsdist f230132
     }
cvsdist f230132
 
cvsdist f230132
     do {
cvsdist f230132
 	print "All OK? (Yes, [C]ontinue / No, [R]eselect) : ";
cvsdist f230132
-	$ans = <STDIN>; chomp $ans;
cvsdist f230132
+	$ans = &get_from_stdin; chomp $ans;
cvsdist f230132
     } until ($ans =~ /[yYnNcCrR].*/);
cvsdist f230132
 
cvsdist f230132
 } until ($ans =~ /^[yYcC]/);
cvsdist f230132
@@ -161,7 +169,7 @@
cvsdist f230132
 	}
cvsdist f230132
 	print "   Which to install? (0..$cf) : ";
cvsdist f230132
 
cvsdist f230132
-	$ans = <STDIN>; chomp $ans;
cvsdist f230132
+	$ans = &get_from_stdin; chomp $ans;
cvsdist f230132
 	if ($ans eq "") {$ans = 0};
cvsdist f230132
 	if ($ans < 0 || $ans > $cf) { $ans = 0 };
cvsdist f230132
 
cvsdist f230132
@@ -176,7 +184,7 @@
cvsdist f230132
 
cvsdist f230132
     do {
cvsdist f230132
 	print "All OK? (Yes, [C]ontinue / No, [R]eselect) : ";
cvsdist f230132
-	$ans = <STDIN>; chomp $ans;
cvsdist f230132
+	$ans = &get_from_stdin; chomp $ans;
cvsdist f230132
     } until ($ans =~ /^[yYnNcCrR]/);
cvsdist f230132
 
cvsdist f230132
 } until ($ans =~ /^[yYcC]/);
cvsdist f230132
@@ -229,3 +237,14 @@
cvsdist f230132
 	($af[2] <=> $bf[2]) || ($af[1] cmp $bf[1]);
cvsdist f230132
 }
cvsdist f230132
 
cvsdist f230132
+sub get_from_stdin {
cvsdist f230132
+    my $retval;
cvsdist f230132
+
cvsdist f230132
+    if ( $pipeflag ) {
cvsdist f230132
+	$retval = shift (@stdin);
cvsdist f230132
+    } else {
cvsdist f230132
+	$retval = scalar (<STDIN>);
cvsdist f230132
+    }
cvsdist f230132
+    return $retval;
cvsdist f230132
+}
cvsdist f230132
+