regress: replace "pipein" command with "stdin"

Easier to provide in a portable way and sufficient for our test cases.
diff --git a/regress/NiHTest.pm b/regress/NiHTest.pm
index 60eedbe..6aaff01 100644
--- a/regress/NiHTest.pm
+++ b/regress/NiHTest.pm
@@ -82,8 +82,8 @@
 #	pipefile FILE
 #	    pipe FILE to program's stdin.
 #
-#	pipein COMMAND ARGS ...
-#	    pipe output of running COMMAND to program's stdin.
+#	stdin TEST
+#	    Provide TEXT to program's stdin.
 #
 #   precheck COMMAND ARGS ...
 #		if COMMAND exits with non-zero status, skip test.
@@ -162,7 +162,6 @@
 		'file-new' => { type => 'string string' },
 		mkdir => { type => 'string string' },
 		pipefile => { type => 'string', once => 1 },
-		pipein => { type => 'string', once => 1 },
 		precheck => { type => 'string...' },
 		preload => { type => 'string', once => 1 },
 		program => { type => 'string', once => 1 },
@@ -170,6 +169,7 @@
 		setenv => { type => 'string string' },
 		stderr => { type => 'string' },
 		'stderr-replace' => { type => 'string string' },
+		stdin => { type => 'string' },
 		stdout => { type => 'string' },
 		touch => { type => 'int string' },
 		ulimit => { type => 'char string' }
@@ -361,6 +361,10 @@
 		delete ${ENV{$preload_env_var}};
 	}
 
+	if ($self->{test}->{stdin}) {
+		$self->{stdin} = [ @{$self->{test}->{stdin}} ];
+	}
+
 	if ($self->{test}->{stdout}) {
 		$self->{expected_stdout} = [ @{$self->{test}->{stdout}} ];
 	}
@@ -452,7 +456,7 @@
 	$self->run_precheck() if ($self->{test}->{precheck});
 
 	$self->end_test('SKIP') if ($self->{test}->{preload} && ($^O eq 'darwin' || $^O eq 'MSWin32'));
-	$self->end_test('SKIP') if (($self->{test}->{pipein} || $self->{test}->{pipefile}) && $^O eq 'MSWin32');
+	$self->end_test('SKIP') if ($self->{test}->{pipefile} && $^O eq 'MSWin32');
 }
 
 
@@ -952,8 +956,8 @@
 		}
 	}
 
-	if ($test{pipefile} && $test{pipein}) {
-		$self->warn_file("both pipefile and pipein set, choose one");
+	if ($test{pipefile} && $test{stdin}) {
+		$self->warn_file("both pipefile and stdin provided, choose one");
 		$ok = 0;
 	}
 
@@ -1163,7 +1167,6 @@
 
 sub run_program {
 	my ($self) = @_;
-	goto &pipein_win32 if (($^O eq 'MSWin32') or ($^O eq 'msys')) && $self->{test}->{pipein};
 	my ($stdin, $stdout, $stderr);
 	$stderr = gensym;
 
@@ -1183,16 +1186,10 @@
 	$self->{stdout} = [];
 	$self->{stderr} = [];
 
-	if ($self->{test}->{pipein}) {
-                my $fh;
-                open($fh, "$self->{test}->{pipein} |");
-                if (!defined($fh)) {
-                        $self->die("cannot run pipein command [$self->{test}->{pipein}: $!");
+	if ($self->{test}->{stdin}) {
+		foreach my $line (@{$self->{test}->{stdin}}) {
+                        print $stdin $line . "\n";
                 }
-                while (my $line = <$fh>) {
-                        print $stdin $line;
-                }
-                close($fh);
                 close($stdin);
         }
 
@@ -1216,42 +1213,6 @@
 	$self->{exit_status} = $? >> 8;
 }
 
-sub pipein_win32() {
-	my ($self) = @_;
-
-	# TODO this is currently broken, IPC::Cmd::run fails to load
-	my $program = $self->find_program($self->{test}->{program});
-	my $cmd = "$self->{test}->{pipein} | $program " . join(' ', map ({ args_decode($_, $self->{srcdir}); } @{$self->{test}->{args}}));
-	my ($success, $error_message, $full_buf, $stdout_buf, $stderr_buf) = IPC::Cmd::run(command => $cmd);
-	if (!$success) {
-		### TODO: catch errors?
-	}
-
-	my @stdout = map { s/[\r\n]+$// } @$stdout_buf;
-	$self->{stdout} = \@stdout;
-        $self->{stderr} = [];
-
-	my $prg = $self->{test}->{program};
-	$prg =~ s,.*/,,;
-	foreach my $line (@$stderr_buf) {
-		$line =~ s/[\r\n]+$//;
-
-		$line =~ s/^[^: ]*$prg(\.exe)?: //;
-		if (defined($self->{test}->{'stderr-replace'})) {
-			$line = $self->stderr_rewrite($self->{test}->{'stderr-replace'}, $line);
-		}
-		push @{$self->{stderr}}, $line;
-	}
-
-	$self->{exit_status} = 1;
-	if ($success) {
-		$self->{exit_status} = 0;
-	}
-	elsif ($error_message =~ /exited with value ([0-9]+)$/) {
-		$self->{exit_status} = $1 + 0;
-	}
-}
-
 sub sandbox_create {
 	my ($self, $tag) = @_;
 
diff --git a/regress/add_from_stdin.test b/regress/add_from_stdin.test
index 6736438..07f6c4a 100644
--- a/regress/add_from_stdin.test
+++ b/regress/add_from_stdin.test
@@ -1,5 +1,5 @@
 # add stdin to zip
-pipein echo This is a test, and it seems to have been successful.
+stdin This is a test, and it seems to have been successful.
 args -- teststdin.zip add_file teststring.txt /dev/stdin 0 -1
 return 0
 file-new teststdin.zip teststdin.zip