mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-09 19:27:42 +01:00
fgetln: Cleanup function
Reindent, remove commented code and translate variable names to english
This commit is contained in:
parent
aa605d5f86
commit
b478b9dd03
@ -1,3 +1,8 @@
|
|||||||
|
2005-07-25 Guillem Jover <guillem@debian.org>
|
||||||
|
|
||||||
|
* fgetln.c (fgetln): Reindent, remove commented code and translate
|
||||||
|
variable names to english.
|
||||||
|
|
||||||
2005-07-25 Guillem Jover <guillem@debian.org>
|
2005-07-25 Guillem Jover <guillem@debian.org>
|
||||||
|
|
||||||
* Versions: New file.
|
* Versions: New file.
|
||||||
|
20
fgetln.c
20
fgetln.c
@ -9,24 +9,20 @@ char *
|
|||||||
fgetln (stream, len)
|
fgetln (stream, len)
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
size_t *len;
|
size_t *len;
|
||||||
|
|
||||||
{
|
{
|
||||||
char *line=NULL;
|
char *line=NULL;
|
||||||
size_t leido = 0;
|
size_t nread = 0;
|
||||||
|
|
||||||
while (leido == 1) {
|
while (nread == 1) {
|
||||||
if ((leido = getline (&line, len, stream)) == -1)
|
nread = getline (&line, len, stream);
|
||||||
return NULL;
|
if (nread == -1)
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (*(line+leido) != '\n')
|
(*len)--; /* get rid of the trailing \0, fgetln
|
||||||
// if (leido != 0)
|
does not have it */
|
||||||
(*len)--; /* get rid of the trailing \0, fgetln
|
|
||||||
does not have it */
|
|
||||||
// if (leido == 1)
|
|
||||||
// leido = getline (&line, len, stream);
|
|
||||||
|
|
||||||
// printf ("Caracter '%c' - Leido '%d'\n", *(line+leido-1), leido);
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user