mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-09 13:30:34 +00:00
error when seeking on a tty (LinkIIgs)
This commit is contained in:
parent
feee4d5809
commit
93fd6cb58c
@ -217,6 +217,13 @@ namespace MPW
|
|||||||
|
|
||||||
int fd = f.cookie;
|
int fd = f.cookie;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* LinkIIgs does a seek on stdin. If it doesn't cause an
|
||||||
|
* error, then it attempts to read a list of files from stdin,
|
||||||
|
* which causes problems.
|
||||||
|
* (Get_Standard_Input -> fseek -> lseek -> ioctl )
|
||||||
|
* to compensate, error out if isatty.
|
||||||
|
*/
|
||||||
|
|
||||||
// TODO - MacOS returns eofERR and sets mark to eof
|
// TODO - MacOS returns eofERR and sets mark to eof
|
||||||
// if seeking past the eof.
|
// if seeking past the eof.
|
||||||
@ -237,18 +244,33 @@ namespace MPW
|
|||||||
return kEINVAL;
|
return kEINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, " seek(%02x, %08x, %02x)\n", fd, offset, nativeWhence);
|
fprintf(stderr, " lseek(%02x, %08x, %02x)\n", fd, offset, nativeWhence);
|
||||||
|
|
||||||
|
if (::isatty(fd))
|
||||||
|
{
|
||||||
|
off_t rv = -1;
|
||||||
|
|
||||||
|
d0 = kEINVAL;
|
||||||
|
f.error = 0;
|
||||||
|
|
||||||
|
memoryWriteLong(rv, arg + 4);
|
||||||
|
memoryWriteWord(f.error, parm + 2);
|
||||||
|
return d0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
off_t rv = ::lseek(fd, offset, nativeWhence);
|
off_t rv = ::lseek(fd, offset, nativeWhence);
|
||||||
if (rv < 0)
|
if (rv < 0)
|
||||||
{
|
{
|
||||||
d0 = errno_to_errno(errno);
|
d0 = errno_to_errno(errno);
|
||||||
f.error = 0;
|
f.error = 0;
|
||||||
|
perror(NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d0 = 0;
|
d0 = 0;
|
||||||
f.error = 0;
|
f.error = 0;
|
||||||
|
fprintf(stderr, "-> %lld\n", rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
memoryWriteLong(rv, arg + 4);
|
memoryWriteLong(rv, arg + 4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user