stdio.h defines BUFSIZ
[unix-history] / usr / src / usr.bin / f77 / libU77 / fseek_.c
CommitLineData
d030ca6c 1/*
161423a6
RE
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.
d030ca6c 5 *
161423a6
RE
6 * @(#)fseek_.c 5.1 %G%
7 */
8
9/*
d030ca6c
DW
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
27extern unit units[];
28
29long fseek_(lu, off, from)
30long *lu, *off, *from;
31{
abb67f25
DW
32 if (*lu < 0 || *lu >= MXUNIT)
33 return((long)(errno=F_ERUNIT));
34 if (*from < 0 || *from > 2)
d030ca6c
DW
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}