Last change
on this file since d21fc6f was b28a12e, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Zero redundant declarations.
|
-
Property mode
set to
100644
|
File size:
968 bytes
|
Rev | Line | |
---|
[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | posit.c -- position a file to a specific relative sector
|
---|
| 4 | Version 4 -- 1987-06-29 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[f40a309] | 9 |
|
---|
| 10 | /*
|
---|
| 11 | =============================================================================
|
---|
| 12 | posit(fd, pos) -- position file 'fd' at sector 'pos'.
|
---|
| 13 | =============================================================================
|
---|
| 14 | */
|
---|
| 15 |
|
---|
[7258c6a] | 16 | int16_t posit(int16_t fd, uint16_t pos)
|
---|
[f40a309] | 17 | {
|
---|
| 18 | register struct fcb *fp;
|
---|
| 19 |
|
---|
| 20 | if ((fd < 0) OR (fd > MAXCHAN)) {
|
---|
| 21 |
|
---|
| 22 | errno = EBADF;
|
---|
| 23 | return(FAILURE);
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | fp = chantab[fd].c_arg;
|
---|
| 27 |
|
---|
| 28 | if ((chantab[fd].c_seek EQ 0)
|
---|
| 29 | OR ((pos << FILESHFT) > fp->curlen)) {
|
---|
| 30 |
|
---|
| 31 | errno = EINVAL;
|
---|
| 32 | fp->modefl |= FC_ERR;
|
---|
| 33 | return(FAILURE);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | fp->curlsn = pos;
|
---|
| 37 | fp->offset = 0;
|
---|
| 38 |
|
---|
| 39 | if (_seek(fp) < 0) {
|
---|
| 40 |
|
---|
| 41 | errno = EIO;
|
---|
| 42 | fp->modefl |= FC_ERR;
|
---|
| 43 | return(FAILURE);
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | return(SUCCESS);
|
---|
| 47 | }
|
---|
[6262b5c] | 48 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.