#!./perl

# $RCSfile: argv.ntt,v $$Revision: 1.1 $$Date: 1996/10/12 21:06:47 $

print "1..5\n";

open(try, '>Io.argv.tmp') || (die "Can't open temp file.");
print try "a line\n";
close try;

#
# Removed the './' qualifier from front of perl command.  GJRL
# Encased 'while (<>)...' in double quotes (was in single quotes) as per
# PERL 4 version.  GJRL 
#
$x = `perl -e "while (<>) {print \$.,\$_;}" Io.argv.tmp Io.argv.tmp`;

if ($x eq "1a line\n2a line\n") {print "ok 1\n";} else {print "not ok 1\n";}

#
# Removed the './' qualifier from front of perl command.  GJRL
# Encased 'while (<>)...' in double quotes (was in single quotes) as per
# PERL 4 version.  GJRL 
#
$x = `echo foo|perl -e "while (<>) {print $_;}" Io.argv.tmp -`;

if ($x eq "a line\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}

#
# Removed the './' qualifier from front of perl command.  GJRL
# Encased 'while (<>)...' in double quotes (was in single quotes) as per
# PERL 4 version.  GJRL 
#
$x = `echo foo|perl -e "while (<>) {print $_;}"`;

if ($x eq "foo\n") {print "ok 3\n";} else {print "not ok 3 :$x:\n";}

#
# NTTCLEAN: Modifications have been made to the following line to
#           make it Windows-NT compliant:
#           -> "/dev/null" was translated into "nul"
#
@ARGV = ('Io.argv.tmp', 'Io.argv.tmp', 'nul', 'Io.argv.tmp');
while (<>) {
    $y .= $. . $_;
    if (eof()) {
	if ($. == 3) {print "ok 4\n";} else {print "not ok 4\n";}
    }
}

if ($y eq "1a line\n2a line\n3a line\n")
    {print "ok 5\n";}
else
    {print "not ok 5\n";}

#
# This command translated into 'del /f/q ...'  GJRL
#`/bin/rm -f Io.argv.tmp`;
unlink Io.argv.tmp;
