Skip to content

Commit 85cb9f9

Browse files
committed
Fix fgetln(3) for consistency
1 parent 276ae6e commit 85cb9f9

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,8 @@ target_link_libraries(cbf_standardize_numbers
11101110
cbf
11111111
"${libm}")
11121112
if(NOT HAVE_FGETLN)
1113-
target_sources(cbf_standardize_numbers PRIVATE "${CBF__SRC}/fgetln.c")
1113+
target_sources(cbf_standardize_numbers
1114+
PRIVATE "${CBF__SRC}/fgetln.c")
11141115
endif()
11151116

11161117
add_executable(cbf_tail

examples/cbf_standardize_numbers.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
#include <string.h>
1616

1717

18-
char * fgetln(FILE *, size_t *);
18+
#ifndef HAVE_FGETLN
19+
# define fgetln _cbf_fgetln
20+
char *
21+
_cbf_fgetln(FILE *stream, size_t *len);
22+
#endif
1923

2024
void usage ( void ) {
2125

src/fgetln.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
#include <stdlib.h>
3232
#include <string.h>
3333

34-
#ifndef HAVE_fgetln
3534
char *
36-
fgetln(FILE *stream, size_t *len)
35+
_cbf_fgetln(FILE *stream, size_t *len)
3736
{
3837
static char *buf = NULL;
3938
static size_t buflen = 0;
@@ -63,4 +62,3 @@ fgetln(FILE *stream, size_t *len)
6362
*len = strlen(buf);
6463
return buf;
6564
}
66-
#endif /* !defined(HAVE_fgetln) */

0 commit comments

Comments
 (0)