#!/usr/local/bin/perl

$_= `uname -sr`;

if (/^SunOS 5/)
{
    $I_PUSH = 0x5302;
    $I_POP  = 0x5303;
    $I_LOOK = 0x5304;
}
elsif (/^SunOS 4/)
{
    $I_PUSH = 0x80095302;
    $I_POP  = 0x20005303;
    $I_LOOK = 0x40095304;
}

$I_PUSH || die "Does $_ have <stropts.h>?\n";

open (TTY, "/dev/tty") || die $!;

ioctl (TTY, $I_POP,  "ttcompat") || warn "$! ttcompat\n";
ioctl (TTY, $I_POP,  "ldterm")   || warn "$! ldterm\n";
ioctl (TTY, $I_POP,  "wc")       || warn "$! wc\n";
ioctl (TTY, $I_PUSH, "ldterm")   || die $!;
ioctl (TTY, $I_PUSH, "ttcompat") || die $!;
