istream.c revision 7e1f68ad71d3485f1882142837b01f7a98ca8467
/* Copyright (c) 2002-2003 Timo Sirainen */
#include "lib.h"
#include "istream-internal.h"
{
}
{
}
{
}
{
}
{
max_size);
}
{
return -1;
}
{
/* within buffer */
return;
}
/* have to seek forward */
return;
}
{
return;
}
return;
}
{
}
{
}
{
char *ret_buf;
size_t i;
stream->stream_errno = 0;
return NULL;
}
i_error("i_stream_next_line() called for unmodifyable stream");
return NULL;
}
/* @UNSAFE */
/* got it */
else
i++;
break;
}
}
return ret_buf;
}
{
char *line;
return line;
if (i_stream_read(stream) > 0)
return line;
}
{
*size = 0;
return NULL;
}
}
{
*size = 0;
return NULL;
}
}
{
do {
return 1;
/* we need more data */
if (ret > 0)
} while (ret > 0);
}
{
}
#ifdef STREAM_TEST
/* gcc istream.c -o teststream liblib.a -Wall -DHAVE_CONFIG_H -DSTREAM_TEST -g */
#include <fcntl.h>
#include <unistd.h>
#include "ostream.h"
{
size_t i;
for (i = 0; i < size; i++)
}
int main(void)
{
unsigned char buf[1024];
const unsigned char *data;
lib_init();
if (fd1 < 0)
i_fatal("open() failed: %m");
if (fd2 < 0)
i_fatal("open() failed: %m");
/* write initial data */
for (i = 0; i < sizeof(buf); i++)
/* test reading */
i_stream_seek(input, 0);
/* test moving data */
i_stream_seek(input, 0);
/* test moving with limits */
i_stream_seek(l_input, 0);
i_stream_seek(input, 0);
/* reading within limits */
i_stream_seek(l_input, 0);
unlink("teststream.1");
unlink("teststream.2");
return 0;
}
#endif