Subversion Repositories Kolibri OS

Rev

Rev 4921 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4921 Rev 6099
Line 15... Line 15...
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16
 */
16
 */
Line 17... Line 17...
17
 
17
 
18
/*
18
/*
19
FUNCTION
19
FUNCTION
Line 20... Line 20...
20
<>---get character string from a file or stream
20
<>, <>---get character string from a file or stream
21
 
21
 
22
INDEX
22
INDEX
-
 
23
	fgets
-
 
24
INDEX
23
	fgets
25
	fgets_unlocked
-
 
26
INDEX
-
 
27
	_fgets_r
Line 24... Line 28...
24
INDEX
28
INDEX
25
	_fgets_r
29
	_fgets_unlocked_r
26
 
30
 
Line -... Line 31...
-
 
31
ANSI_SYNOPSIS
-
 
32
        #include 
-
 
33
	char *fgets(char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
-
 
34
 
27
ANSI_SYNOPSIS
35
	#define _GNU_SOURCE
28
        #include 
36
        #include 
Line -... Line 37...
-
 
37
	char *fgets_unlocked(char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
-
 
38
 
-
 
39
        #include 
29
	char *fgets(char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
40
	char *_fgets_r(struct _reent *<[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
30
 
41
 
31
        #include 
42
        #include 
32
	char *_fgets_r(struct _reent *<[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
43
	char *_fgets_unlocked_r(struct _reent *<[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>);
33
 
44
 
34
TRAD_SYNOPSIS
45
TRAD_SYNOPSIS
Line -... Line 46...
-
 
46
	#include 
-
 
47
	char *fgets(<[buf]>,<[n]>,<[fp]>)
-
 
48
        char *<[buf]>;
-
 
49
	int <[n]>;
-
 
50
	FILE *<[fp]>;
-
 
51
 
-
 
52
	#define _GNU_SOURCE
35
	#include 
53
	#include 
36
	char *fgets(<[buf]>,<[n]>,<[fp]>)
54
	char *fgets_unlocked(<[buf]>,<[n]>,<[fp]>)
37
        char *<[buf]>;
55
        char *<[buf]>;
38
	int <[n]>;
56
	int <[n]>;
39
	FILE *<[fp]>;
57
	FILE *<[fp]>;
40
 
58
 
Line -... Line 59...
-
 
59
	#include 
-
 
60
	char *_fgets_r(<[ptr]>, <[buf]>,<[n]>,<[fp]>)
-
 
61
	struct _reent *<[ptr]>;
-
 
62
        char *<[buf]>;
-
 
63
	int <[n]>;
-
 
64
	FILE *<[fp]>;
-
 
65
 
41
	#include 
66
	#include 
42
	char *_fgets_r(<[ptr]>, <[buf]>,<[n]>,<[fp]>)
67
	char *_fgets_unlocked_r(<[ptr]>, <[buf]>,<[n]>,<[fp]>)
43
	struct _reent *<[ptr]>;
68
	struct _reent *<[ptr]>;
44
        char *<[buf]>;
69
        char *<[buf]>;
Line 45... Line 70...
45
	int <[n]>;
70
	int <[n]>;
-
 
71
	FILE *<[fp]>;
-
 
72
 
-
 
73
DESCRIPTION
-
 
74
	Reads at most <[n-1]> characters from <[fp]> until a newline
-
 
75
	is found. The characters including to the newline are stored
-
 
76
	in <[buf]>. The buffer is terminated with a 0.
-
 
77
 
-
 
78
	<> is a non-thread-safe version of <>.
-
 
79
	<> may only safely be used within a scope
46
	FILE *<[fp]>;
80
	protected by flockfile() (or ftrylockfile()) and funlockfile().  This
47
 
81
	function may safely be used in a multi-threaded program if and only
Line 48... Line 82...
48
DESCRIPTION
82
	if they are called while the invoking thread owns the (FILE *)
49
	Reads at most <[n-1]> characters from <[fp]> until a newline
83
	object, as is the case after a successful call to the flockfile() or
50
	is found. The characters including to the newline are stored
84
	ftrylockfile() functions.  If threads are disabled, then
51
	in <[buf]>. The buffer is terminated with a 0.
85
	<> is equivalent to <>.
Line 63... Line 97...
63
PORTABILITY
97
PORTABILITY
64
	<> should replace all uses of <>. Note however
98
	<> should replace all uses of <>. Note however
65
	that <> returns all of the data, while <> removes
99
	that <> returns all of the data, while <> removes
66
	the trailing newline (with no indication that it has done so.)
100
	the trailing newline (with no indication that it has done so.)
Line -... Line 101...
-
 
101
 
-
 
102
	<> is a GNU extension.
67
 
103
 
68
Supporting OS subroutines required: <>, <>, <>,
104
Supporting OS subroutines required: <>, <>, <>,
69
<>, <>, <>, <>.
105
<>, <>, <>, <>.
Line 70... Line 106...
70
*/
106
*/
71
 
107
 
72
#include <_ansi.h>
108
#include <_ansi.h>
73
#include 
109
#include 
Line -... Line 110...
-
 
110
#include 
-
 
111
#include "local.h"
-
 
112
 
-
 
113
#ifdef __IMPL_UNLOCKED__
-
 
114
#define _fgets_r _fgets_unlocked_r
74
#include 
115
#define fgets fgets_unlocked
75
#include "local.h"
116
#endif
76
 
117
 
77
/*
118
/*
78
 * Read at most n-1 characters from the given file.
119
 * Read at most n-1 characters from the given file.