Subversion Repositories Kolibri OS

Rev

Rev 4921 | Details | Compare with Previous | Last modification | View Log | RSS feed

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