1*47944Sbostic /*-
2*47944Sbostic * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic * All rights reserved.
42530Sdlw *
5*47944Sbostic * %sccs.include.proprietary.c%
623015Skre */
723015Skre
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)fseek_.c 5.2 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic
1223015Skre /*
132530Sdlw * position a file associated with a fortran logical unit
142530Sdlw *
152530Sdlw * calling sequence:
162530Sdlw * ierror = fseek(lunit, ioff, ifrom)
172530Sdlw * where:
182530Sdlw * lunit is an open logical unit
192530Sdlw * ioff is an offset in bytes relative to the position specified by ifrom
202530Sdlw * ifrom - 0 means 'beginning of the file'
212530Sdlw * - 1 means 'the current position'
222530Sdlw * - 2 means 'the end of the file'
232530Sdlw * ierror will be 0 if successful, a system error code otherwise.
242530Sdlw */
252530Sdlw
262530Sdlw #include <stdio.h>
272530Sdlw #include "../libI77/f_errno.h"
282530Sdlw #include "../libI77/fiodefs.h"
292530Sdlw
302530Sdlw extern unit units[];
312530Sdlw
fseek_(lu,off,from)322530Sdlw long fseek_(lu, off, from)
332530Sdlw long *lu, *off, *from;
342530Sdlw {
352578Sdlw if (*lu < 0 || *lu >= MXUNIT)
362578Sdlw return((long)(errno=F_ERUNIT));
372578Sdlw if (*from < 0 || *from > 2)
382530Sdlw return((long)(errno=F_ERARG));
392530Sdlw if (!units[*lu].ufd)
402530Sdlw return((long)(errno=F_ERNOPEN));
412530Sdlw if (fseek(units[*lu].ufd, *off, (int)*from) < 0)
422530Sdlw return((long)errno);
432530Sdlw return(0L);
442530Sdlw }
45