blob: f9f3371ab2bbe37a07558f3b6b614375a9e03738 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include <stdio.h>
#include "_stdio.h"
/** set the file position indicator **/
int fseek(FILE *stream, long int offset, int whence)
{
SIGNAL_SAFE(0);
ASSERT_STREAM(stream, 0, 0);
if (stream->text && offset != 0) {
if (whence != SEEK_SET) {
UNDEFINED("In call to fseek(): Only SEEK_SET is supported for text files");
}
ASSERT_PREV(offset, stream->valid_ftell, stream->nvalid_ftell, "ftell");
}
if (whence == SEEK_CUR) {
} else if (whence == SEEK_END) {
} else if (whence == SEEK_SET) {
}
stream->operation = OP_NONE;
return 1;
}
/***
sets the file position indicator for ARGUMENT(stream).
How the indicator is set is determined by ARGUMENT(whence):
FLAG(CONSTANT(SEEK_SET), The indicator is set to the beginning of the file plus ARGUMENT(offset))
FLAG(CONSTANT(SEEK_CUR), The indicator is advanced from its current position by ARGUMENT(offset), which may be negative)
FLAG(CONSTANT(SEEK_END), The indicator is set to the end of the file minus ARGUMENT(offset))
A successful call to fn(fseek) clears the end-of-file indicator and discards
any characters pushed with fn(ungetc).
***/
/*
UNDEFINED(Specifying CONSTANT(SEEK_END) for ARGUMENT(whence) on a binary file)
UNDEFINED(Specifying a value for ARGUMENT(offset) other than 0 or a previous return value of FUNCTION(ftell) on a text file)
STDC(1)
*/
|