This commit is contained in:
parent
d91745c921
commit
74ec716754
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stdio.c 124 2008-03-12 12:21:33Z baconevi $
|
* $Id: stdio.c 125 2008-03-12 12:25:11Z baconevi $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -395,7 +395,7 @@ ase_ssize_t ase_getdelim (
|
|||||||
#else
|
#else
|
||||||
b = (ase_char_t*) malloc (sizeof(ase_char_t)*(capa+1));
|
b = (ase_char_t*) malloc (sizeof(ase_char_t)*(capa+1));
|
||||||
#endif
|
#endif
|
||||||
if (b == ASE_NULL) return -1;
|
if (b == ASE_NULL) return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ase_feof(fp))
|
if (ase_feof(fp))
|
||||||
@ -410,6 +410,11 @@ ase_ssize_t ase_getdelim (
|
|||||||
if (c == ASE_CHAR_EOF)
|
if (c == ASE_CHAR_EOF)
|
||||||
{
|
{
|
||||||
if (ase_ferror(fp))
|
if (ase_ferror(fp))
|
||||||
|
{
|
||||||
|
len = (ase_size_t)-2;
|
||||||
|
goto exit_task;
|
||||||
|
}
|
||||||
|
if (len == 0)
|
||||||
{
|
{
|
||||||
len = (ase_size_t)-1;
|
len = (ase_size_t)-1;
|
||||||
goto exit_task;
|
goto exit_task;
|
||||||
@ -426,7 +431,7 @@ ase_ssize_t ase_getdelim (
|
|||||||
nb = realloc (b, ncapa*sizeof(ase_char_t));
|
nb = realloc (b, ncapa*sizeof(ase_char_t));
|
||||||
if (nb == ASE_NULL)
|
if (nb == ASE_NULL)
|
||||||
{
|
{
|
||||||
len = (ase_size_t)-1;
|
len = (ase_size_t)-2;
|
||||||
goto exit_task;
|
goto exit_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stdio.h 122 2008-03-12 11:55:39Z baconevi $
|
* $Id: stdio.h 125 2008-03-12 12:25:11Z baconevi $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ASE_UTL_STDIO_H_
|
#ifndef _ASE_UTL_STDIO_H_
|
||||||
@ -64,6 +64,9 @@ int ase_dprintf (const ase_char_t* fmt, ...);
|
|||||||
FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode);
|
FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode);
|
||||||
FILE* ase_popen (const ase_char_t* cmd, const ase_char_t* mode);
|
FILE* ase_popen (const ase_char_t* cmd, const ase_char_t* mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns -2 on error, -1 on eof, length of data read on success
|
||||||
|
*/
|
||||||
ase_ssize_t ase_getline (ase_char_t **buf, ase_size_t *n, FILE *fp);
|
ase_ssize_t ase_getline (ase_char_t **buf, ase_size_t *n, FILE *fp);
|
||||||
ase_ssize_t ase_getdelim (
|
ase_ssize_t ase_getdelim (
|
||||||
ase_char_t **buf, ase_size_t *n, ase_char_t delim, FILE *fp);
|
ase_char_t **buf, ase_size_t *n, ase_char_t delim, FILE *fp);
|
||||||
|
Loading…
Reference in New Issue
Block a user