source: trunk/libtransmission/ggets.h @ 7197

Last change on this file since 7197 was 7197, checked in by charles, 13 years ago

(libT) add the #include guards to "private" third party header files.

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