source: trunk/libtransmission/ggets.h @ 6795

Last change on this file since 6795 was 6795, checked in by charles, 14 years ago

run libT, cli, daemon, gtk through the source-code formatter "uncrustify" as promised/threatened

File size: 1.3 KB
Line 
1/* File ggets.h  - goodgets is a safe alternative to gets */
2/* By C.B. Falconer.  Public domain 2002-06-22            */
3/*    attribution appreciated.                            */
4
5
6/* Revised 2002-06-26  New prototype.
7           2002-06-27  Incomplete final lines
8 */
9
10/* fggets and ggets [which is fggets(ln, stdin)] set *ln to
11   a buffer filled with the next complete line from the text
12   stream f.  The storage has been allocated within fggets,
13   and is normally reduced to be an exact fit.  The trailing
14   \n has been removed, so the resultant line is ready for
15   dumping with puts.  The buffer will be as large as is
16   required to hold the complete line.
17
18   Note: this means a final file line without a \n terminator
19   has an effective \n appended, as EOF occurs within the read.
20
21   If no error occurs fggets returns 0.  If an EOF occurs on
22   the input file, EOF is returned.  For memory allocation
23   errors some positive value is returned.  In this case *ln
24   may point to a partial line.  For other errors memory is
25   freed and *ln is set to NULL.
26
27   Freeing of assigned storage is the callers responsibility
28 */
29
30#ifndef ggets_h_
31#define ggets_h_
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37int fggets( char* *ln,
38            FILE * f );
39
40#define ggets( ln ) fggets( ln, stdin )
41
42#ifdef __cplusplus
43}
44#endif
45#endif
46/* END ggets.h */
Note: See TracBrowser for help on using the repository browser.