1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)fseek_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * position a file associated with a fortran logical unit 14 * 15 * calling sequence: 16 * ierror = fseek(lunit, ioff, ifrom) 17 * where: 18 * lunit is an open logical unit 19 * ioff is an offset in bytes relative to the position specified by ifrom 20 * ifrom - 0 means 'beginning of the file' 21 * - 1 means 'the current position' 22 * - 2 means 'the end of the file' 23 * ierror will be 0 if successful, a system error code otherwise. 24 */ 25 26 #include <stdio.h> 27 #include "../libI77/f_errno.h" 28 #include "../libI77/fiodefs.h" 29 30 extern unit units[]; 31 32 long fseek_(lu, off, from) 33 long *lu, *off, *from; 34 { 35 if (*lu < 0 || *lu >= MXUNIT) 36 return((long)(errno=F_ERUNIT)); 37 if (*from < 0 || *from > 2) 38 return((long)(errno=F_ERARG)); 39 if (!units[*lu].ufd) 40 return((long)(errno=F_ERNOPEN)); 41 if (fseek(units[*lu].ufd, *off, (int)*from) < 0) 42 return((long)errno); 43 return(0L); 44 } 45