Introduce old redir program
[lcapit-junk-code.git] / books / apue / seekable.c
blob4deeeaacee17413e79bfcdf0df59a35421253133
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>
9 int main(void)
11 if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1 && errno == ESPIPE)
12 printf("cannot seek\n");
13 else
14 printf("seek OK\n");
16 return 0;