1*2530Sdlw /* 2*2530Sdlw char id_fseek[] = "@(#)fseek_.c 1.1"; 3*2530Sdlw * 4*2530Sdlw * position a file associated with a fortran logical unit 5*2530Sdlw * 6*2530Sdlw * calling sequence: 7*2530Sdlw * ierror = fseek(lunit, ioff, ifrom) 8*2530Sdlw * where: 9*2530Sdlw * lunit is an open logical unit 10*2530Sdlw * ioff is an offset in bytes relative to the position specified by ifrom 11*2530Sdlw * ifrom - 0 means 'beginning of the file' 12*2530Sdlw * - 1 means 'the current position' 13*2530Sdlw * - 2 means 'the end of the file' 14*2530Sdlw * ierror will be 0 if successful, a system error code otherwise. 15*2530Sdlw */ 16*2530Sdlw 17*2530Sdlw #include <stdio.h> 18*2530Sdlw #include "../libI77/f_errno.h" 19*2530Sdlw #include "../libI77/fiodefs.h" 20*2530Sdlw 21*2530Sdlw extern unit units[]; 22*2530Sdlw 23*2530Sdlw long fseek_(lu, off, from) 24*2530Sdlw long *lu, *off, *from; 25*2530Sdlw { 26*2530Sdlw if (*lu < 0 || *lu >= MXUNIT || *from < 0 || *from > 2) 27*2530Sdlw return((long)(errno=F_ERARG)); 28*2530Sdlw if (!units[*lu].ufd) 29*2530Sdlw return((long)(errno=F_ERNOPEN)); 30*2530Sdlw if (fseek(units[*lu].ufd, *off, (int)*from) < 0) 31*2530Sdlw return((long)errno); 32*2530Sdlw return(0L); 33*2530Sdlw } 34