repo.or.cz
/
lcapit-junk-code.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Introduce old redir program
[lcapit-junk-code.git]
/
books
/
apue
/
seekable.c
blob
4deeeaacee17413e79bfcdf0df59a35421253133
1
/*
2
* Check if a file specified in stdin is 'seekable'
3
*/
4
#include <stdio.h>
5
#include <sys/types.h>
6
#include <unistd.h>
7
#include <errno.h>
8
9
int
main
(
void
)
10
{
11
if
(
lseek
(
STDIN_FILENO
,
0
,
SEEK_CUR
) == -
1
&&
errno
==
ESPIPE
)
12
printf
(
"cannot seek
\n
"
);
13
else
14
printf
(
"seek OK
\n
"
);
15
16
return
0
;
17
}