t/op/exp.t See if math functions work
t/op/fh.t See if filehandles work
t/op/filetest.t See if file tests work
+t/op/filetest_t.t See if -t file test works
t/op/flip.t See if range operator works
t/op/fork.t See if fork works
t/op/getpid.t See if $$ and getppid work with threads
--- /dev/null
+#!./perl
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+ require './test.pl';
+}
+
+use strict;
+
+plan 2;
+
+my($dev_tty, $dev_null) = qw(/dev/tty /dev/null);
+ ($dev_tty, $dev_null) = qw(con nul ) if $^O =~ /^(MSWin32|os2)$/;
+ ($dev_tty, $dev_null) = qw(TT: _NLA0: ) if $^O eq "VMS";
+
+SKIP: {
+ open(my $tty, "<", $dev_tty)
+ or skip("Can't open terminal '$dev_tty': $!");
+ ok(-t $tty);
+}
+SKIP: {
+ open(my $null, "<", $dev_null)
+ or skip("Can't open null device '$dev_null': $!");
+ ok(!-t $null);
+}
int
PerlLIOIsatty(struct IPerlLIO* piPerl, int fd)
{
- return isatty(fd);
+ /* The Microsoft isatty() function returns true for *all*
+ * character mode devices, including "nul". Our implementation
+ * should only return true if the handle has a console buffer.
+ */
+ DWORD mode;
+ HANDLE fh = (HANDLE)_get_osfhandle(fd);
+ if (fh == (HANDLE)-1) {
+ /* errno is already set to EBADF */
+ return 0;
+ }
+
+ if (GetConsoleMode(fh, &mode))
+ return 1;
+
+ errno = ENOTTY;
+ return 0;
}
int