Subversion Repositories Kolibri OS

Rev

Rev 4921 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4921 Rev 6099
1
/*
1
/*
2
 * Copyright (c) 1990 The Regents of the University of California.
2
 * Copyright (c) 1990 The Regents of the University of California.
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms are permitted
5
 * Redistribution and use in source and binary forms are permitted
6
 * provided that the above copyright notice and this paragraph are
6
 * provided that the above copyright notice and this paragraph are
7
 * duplicated in all such forms and that any documentation,
7
 * duplicated in all such forms and that any documentation,
8
 * advertising materials, and other materials related to such
8
 * advertising materials, and other materials related to such
9
 * distribution and use acknowledge that the software was developed
9
 * distribution and use acknowledge that the software was developed
10
 * by the University of California, Berkeley.  The name of the
10
 * by the University of California, Berkeley.  The name of the
11
 * University may not be used to endorse or promote products derived
11
 * University may not be used to endorse or promote products derived
12
 * from this software without specific prior written permission.
12
 * from this software without specific prior written permission.
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 */
16
 */
17
 
17
 
18
/*
18
/*
19
FUNCTION
19
FUNCTION
20
<>, <>---set file position
20
<>, <>---set file position
21
 
21
 
22
INDEX
22
INDEX
23
	fseek
23
	fseek
24
INDEX
24
INDEX
25
	fseeko
25
	fseeko
26
INDEX
26
INDEX
27
	_fseek_r
27
	_fseek_r
28
INDEX
28
INDEX
29
	_fseeko_r
29
	_fseeko_r
30
 
30
 
31
ANSI_SYNOPSIS
31
ANSI_SYNOPSIS
32
	#include 
32
	#include 
33
	int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>)
33
	int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>);
34
	int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>)
34
	int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>);
35
	int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>,
35
	int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>,
36
	             long <[offset]>, int <[whence]>)
36
	             long <[offset]>, int <[whence]>);
37
	int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>,
37
	int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>,
38
	             off_t <[offset]>, int <[whence]>)
38
	             off_t <[offset]>, int <[whence]>);
39
 
39
 
40
TRAD_SYNOPSIS
40
TRAD_SYNOPSIS
41
	#include 
41
	#include 
42
	int fseek(<[fp]>, <[offset]>, <[whence]>)
42
	int fseek(<[fp]>, <[offset]>, <[whence]>);
43
	FILE *<[fp]>;
43
	FILE *<[fp]>;
44
	long <[offset]>;
44
	long <[offset]>;
45
	int <[whence]>;
45
	int <[whence]>;
46
 
46
 
47
	int fseeko(<[fp]>, <[offset]>, <[whence]>)
47
	int fseeko(<[fp]>, <[offset]>, <[whence]>);
48
	FILE *<[fp]>;
48
	FILE *<[fp]>;
49
	off_t <[offset]>;
49
	off_t <[offset]>;
50
	int <[whence]>;
50
	int <[whence]>;
51
 
51
 
52
	int _fseek_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>)
52
	int _fseek_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>);
53
	struct _reent *<[ptr]>;
53
	struct _reent *<[ptr]>;
54
	FILE *<[fp]>;
54
	FILE *<[fp]>;
55
	long <[offset]>;
55
	long <[offset]>;
56
	int <[whence]>;
56
	int <[whence]>;
57
 
57
 
58
	int _fseeko_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>)
58
	int _fseeko_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>);
59
	struct _reent *<[ptr]>;
59
	struct _reent *<[ptr]>;
60
	FILE *<[fp]>;
60
	FILE *<[fp]>;
61
	off_t <[offset]>;
61
	off_t <[offset]>;
62
	int <[whence]>;
62
	int <[whence]>;
63
 
63
 
64
DESCRIPTION
64
DESCRIPTION
65
Objects of type <> can have a ``position'' that records how much
65
Objects of type <> can have a ``position'' that records how much
66
of the file your program has already read.  Many of the <> functions
66
of the file your program has already read.  Many of the <> functions
67
depend on this position, and many change it as a side effect.
67
depend on this position, and many change it as a side effect.
68
 
68
 
69
You can use <>/<> to set the position for the file identified by
69
You can use <>/<> to set the position for the file identified by
70
<[fp]>.  The value of <[offset]> determines the new position, in one
70
<[fp]>.  The value of <[offset]> determines the new position, in one
71
of three ways selected by the value of <[whence]> (defined as macros
71
of three ways selected by the value of <[whence]> (defined as macros
72
in `<>'):
72
in `<>'):
73
 
73
 
74
<>---<[offset]> is the absolute file position (an offset
74
<>---<[offset]> is the absolute file position (an offset
75
from the beginning of the file) desired.  <[offset]> must be positive.
75
from the beginning of the file) desired.  <[offset]> must be positive.
76
 
76
 
77
<>---<[offset]> is relative to the current file position.
77
<>---<[offset]> is relative to the current file position.
78
<[offset]> can meaningfully be either positive or negative.
78
<[offset]> can meaningfully be either positive or negative.
79
 
79
 
80
<>---<[offset]> is relative to the current end of file.
80
<>---<[offset]> is relative to the current end of file.
81
<[offset]> can meaningfully be either positive (to increase the size
81
<[offset]> can meaningfully be either positive (to increase the size
82
of the file) or negative.
82
of the file) or negative.
83
 
83
 
84
See <>/<> to determine the current file position.
84
See <>/<> to determine the current file position.
85
 
85
 
86
RETURNS
86
RETURNS
87
<>/<> return <<0>> when successful.  On failure, the
87
<>/<> return <<0>> when successful.  On failure, the
88
result is <>.  The reason for failure is indicated in <>:
88
result is <>.  The reason for failure is indicated in <>:
89
either <> (the stream identified by <[fp]> doesn't support
89
either <> (the stream identified by <[fp]> doesn't support
90
repositioning) or <> (invalid file position).
90
repositioning) or <> (invalid file position).
91
 
91
 
92
PORTABILITY
92
PORTABILITY
93
ANSI C requires <>.
93
ANSI C requires <>.
94
 
94
 
95
<> is defined by the Single Unix specification.
95
<> is defined by the Single Unix specification.
96
 
96
 
97
Supporting OS subroutines required: <>, <>, <>,
97
Supporting OS subroutines required: <>, <>, <>,
98
<>, <>, <>, <>.
98
<>, <>, <>, <>.
99
*/
99
*/
100
 
100
 
101
#include <_ansi.h>
101
#include <_ansi.h>
102
#include 
102
#include 
103
#include 
103
#include 
104
#include 
104
#include 
105
#include "local.h"
105
#include "local.h"
106
 
106
 
107
int
107
int
108
_DEFUN(_fseek_r, (ptr, fp, offset, whence),
108
_DEFUN(_fseek_r, (ptr, fp, offset, whence),
109
       struct _reent *ptr _AND
109
       struct _reent *ptr _AND
110
       register FILE *fp  _AND
110
       register FILE *fp  _AND
111
       long offset        _AND
111
       long offset        _AND
112
       int whence)
112
       int whence)
113
{
113
{
114
  return _fseeko_r (ptr, fp, offset, whence);
114
  return _fseeko_r (ptr, fp, offset, whence);
115
}
115
}
116
 
116
 
117
#ifndef _REENT_ONLY
117
#ifndef _REENT_ONLY
118
 
118
 
119
int
119
int
120
_DEFUN(fseek, (fp, offset, whence),
120
_DEFUN(fseek, (fp, offset, whence),
121
       register FILE *fp _AND
121
       register FILE *fp _AND
122
       long offset       _AND
122
       long offset       _AND
123
       int whence)
123
       int whence)
124
{
124
{
125
  return _fseek_r (_REENT, fp, offset, whence);
125
  return _fseek_r (_REENT, fp, offset, whence);
126
}
126
}
127
 
127
 
128
#endif /* !_REENT_ONLY */
128
#endif /* !_REENT_ONLY */