perl 5.0 alpha 2
[p5sagit/p5-mst-13.2.git] / do / seek
1 bool
2 do_seek(stab, pos, whence)
3 STAB *stab;
4 long pos;
5 int whence;
6 {
7     register STIO *stio;
8
9     if (!stab)
10         goto nuts;
11
12     stio = stab_io(stab);
13     if (!stio || !stio->ifp)
14         goto nuts;
15
16 #ifdef ULTRIX_STDIO_BOTCH
17     if (feof(stio->ifp))
18         (void)fseek (stio->ifp, 0L, 2);         /* ultrix 1.2 workaround */
19 #endif
20
21     return fseek(stio->ifp, pos, whence) >= 0;
22
23 nuts:
24     if (dowarn)
25         warn("seek() on unopened file");
26     errno = EBADF;
27     return FALSE;
28 }
29