freewrt_1_0
freewrt_2_0
|
Last change
on this file since fdd4f59 was 4e20789, checked in by Thorsten Glaser <tg@…>, 19 years ago |
|
make this build on GNU/Linux because some functions don't exist
XXX cannot use largefile support because <fts.h> of glibc is 32-bit only
(wbx@ says that doesn't matter though)
git-svn-id: svn://www.freewrt.org/trunk/freewrt@221 afb5a338-a214-0410-bd46-81f09a774fd1
|
-
Property mode
set to
100644
|
|
File size:
480 bytes
|
| Rev | Line | |
|---|
| [9e17a74] | 1 | #define _GNU_SOURCE
|
|---|
| [2c03383] | 2 | #include <sys/types.h>
|
|---|
| [9e17a74] | 3 | #include <sys/cdefs.h>
|
|---|
| 4 | #include <stdio.h>
|
|---|
| [2c03383] | 5 | #include <string.h>
|
|---|
| 6 |
|
|---|
| 7 | #ifdef __GLIBC__
|
|---|
| [4e20789] | 8 | ssize_t getline(char **lineptr, size_t *n, FILE *stream);
|
|---|
| 9 |
|
|---|
| [2c03383] | 10 | char *
|
|---|
| 11 | fgetln (stream, len)
|
|---|
| 12 | FILE *stream;
|
|---|
| 13 | size_t *len;
|
|---|
| 14 | {
|
|---|
| 15 | char *line=NULL;
|
|---|
| 16 | size_t nread = 0;
|
|---|
| 17 |
|
|---|
| 18 | while (nread == 1) {
|
|---|
| 19 | nread = getline (&line, len, stream);
|
|---|
| 20 | if (nread == -1)
|
|---|
| 21 | return NULL;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | (*len)--; /* get rid of the trailing \0, fgetln
|
|---|
| 25 | does not have it */
|
|---|
| 26 |
|
|---|
| 27 | return line;
|
|---|
| 28 | }
|
|---|
| 29 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.