Re: lseek on tty

2023-09-18 Thread ignatios
On Mon, Sep 18, 2023 at 04:20:28PM -0400, Jan Schaumann wrote: > I'm trying to think of why seeking on a terminal > would make sense. Anybody have an idea? Somebody at a historical GUUG or EUUUG* meeting told the story of a student at his work Uni who had did the mainframe equivalent of lseek(

Re: lseek on tty

2023-09-18 Thread Mouse
>>> On NetBSD and macOS, lseek(2) on a tty succeeds: >>> if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 ) >> Some devices are incapable of seeking. The value of the >> pointer associated with such a device is undefined. >> So I'm guessing it depends on whether you think of adding s

Re: lseek on tty

2023-09-18 Thread Jan Schaumann
Mouse wrote: > > On NetBSD and macOS, lseek(2) on a tty succeeds: > > > if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 ) > > > On Linux, this fails. > > > I'm trying to think of why seeking on a terminal would make sense. > > Anybody have an idea? > > Quoting from lseek(2) on a handy machi

Re: lseek on tty

2023-09-18 Thread наб
On Mon, Sep 18, 2023 at 04:20:28PM -0400, Jan Schaumann wrote: > On NetBSD and macOS, lseek(2) on a tty succeeds: > On Linux, this fails. > > I'm trying to think of why seeking on a terminal > would make sense. Anybody have an idea? This is historical UNIX behaviour ‒ the file offset is modified,

Re: lseek on tty

2023-09-18 Thread Mouse
> On NetBSD and macOS, lseek(2) on a tty succeeds: > if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 ) > On Linux, this fails. > I'm trying to think of why seeking on a terminal would make sense. > Anybody have an idea? Quoting from lseek(2) on a handy machine: Some devices are inca

lseek on tty

2023-09-18 Thread Jan Schaumann
Hi, On NetBSD and macOS, lseek(2) on a tty succeeds: int main() { if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 ) fprintf(stderr, "cannot seek\n"); } $ ./a.out