mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
tail: fix reading from terminal on OpenBSD.
isseekable function taken from 9front commit 1c835e37 by ftrvxmtrx.
This commit is contained in:
parent
a2567fcac9
commit
56f760eed1
1 changed files with 8 additions and 1 deletions
|
@ -44,6 +44,7 @@ extern void trunc(Dir*, Dir**);
|
|||
extern vlong tseek(vlong, int);
|
||||
extern void twrite(char*, long);
|
||||
extern void usage(void);
|
||||
static int isseekable(int);
|
||||
|
||||
#define JUMP(o,p) tseek(o,p), copy()
|
||||
|
||||
|
@ -92,7 +93,7 @@ main(int argc, char **argv)
|
|||
usage();
|
||||
if(argc > 1 && (file=open(argv[1],0)) < 0)
|
||||
fatal(argv[1]);
|
||||
seekable = seek(file,0L,0) == 0;
|
||||
seekable = isseekable(file);
|
||||
|
||||
if(!seekable && origin==END)
|
||||
keep();
|
||||
|
@ -361,3 +362,9 @@ usage(void)
|
|||
fprint(2, "%s\n", umsg);
|
||||
exits("usage");
|
||||
}
|
||||
|
||||
static int
|
||||
isseekable(int fd)
|
||||
{
|
||||
return seek(fd, 0, 2) > 0 && seek(fd, 0, 0) == 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue