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