equal
deleted
inserted
replaced
|
1 .TH getln2 3 |
|
2 .SH NAME |
|
3 getln2 \- read one line of data |
|
4 .SH SYNTAX |
|
5 .B #include <getln.h> |
|
6 |
|
7 int \fBgetln2\fP(&\fIss\fR,&\fIsa\fR,&\fIcont\fR,&\fIclen\fR,\fIsep\fR); |
|
8 |
|
9 substdio \fIss\fR; |
|
10 .br |
|
11 stralloc \fIsa\fR; |
|
12 .br |
|
13 char *\fIcont\fR; |
|
14 .br |
|
15 unsigned int \fIclen\fR; |
|
16 .br |
|
17 int \fIsep\fR; |
|
18 .SH DESCRIPTION |
|
19 .B getln2 |
|
20 reads a line of characters, terminated by a |
|
21 .I sep |
|
22 character, |
|
23 from |
|
24 .IR ss . |
|
25 |
|
26 The line is returned in two pieces. |
|
27 The first piece is stored in |
|
28 .IR sa . |
|
29 The second piece is |
|
30 .IR cont , |
|
31 a pointer to |
|
32 .I clen |
|
33 characters inside the |
|
34 .I ss |
|
35 buffer. |
|
36 The second piece must be copied somewhere else |
|
37 before |
|
38 .I ss |
|
39 is used again. |
|
40 |
|
41 If |
|
42 .B getln2 |
|
43 sees end-of-input before it sees |
|
44 .IR sep , |
|
45 it sets |
|
46 .I clen |
|
47 to 0 and does not set |
|
48 .IR cont . |
|
49 It puts the partial line into |
|
50 .IR sa . |
|
51 |
|
52 .B getln2 |
|
53 normally returns 0. |
|
54 If it runs out of memory, |
|
55 or encounters an error from |
|
56 .IR ss , |
|
57 it returns -1, |
|
58 setting |
|
59 .B errno |
|
60 appropriately. |
|
61 .SH "SEE ALSO" |
|
62 stralloc(3), |
|
63 substdio(3), |
|
64 getln(3) |