summaryrefslogtreecommitdiff
path: root/getln.3
blob: ffe1953ea7cdd46929f1a3c5d5d54b617795926c (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
46
47
48
49
50
51
.TH getln 3
.SH NAME
getln \- read one line of data
.SH SYNTAX
.B #include <getln.h>

int \fBgetln\fP(&\fIss\fR,&\fIsa\fR,&\fImatch\fR,\fIsep\fR);

substdio \fIss\fR;
.br
stralloc \fIsa\fR;
.br
int \fImatch\fR;
.br
int \fIsep\fR;
.SH DESCRIPTION
.B getln
reads a line of characters, terminated by a 
.I sep
character,
from
.IR ss .
It returns the line in
.I sa
and sets
.I match
to 1.

If
.B getln
sees end-of-input before it sees
.IR sep ,
it returns the partial line in
.I sa
and sets
.I match
to 0.

.B getln
normally returns 0.
If it runs out of memory,
or encounters an error from
.IR ss ,
it returns -1,
setting
.B errno
appropriately.
.SH "SEE ALSO"
stralloc(3),
substdio(3),
getln2(3)