Mercurial > dovecot > core-2.2
view src/plugins/fts/xml2text.c @ 21390:2e2563132d5f
Updated copyright notices to include the year 2017.
author | Stephan Bosch <stephan.bosch@dovecot.fi> |
---|---|
date | Wed, 11 Jan 2017 02:51:13 +0100 |
parents | 59437f8764c6 |
children | cb108f786fb4 |
line wrap: on
line source
/* Copyright (c) 2011-2017 Dovecot authors, see the included COPYING file */ #include "lib.h" #include "message-parser.h" #include "fts-parser.h" #include <unistd.h> int main(void) { struct fts_parser *parser; unsigned char buf[IO_BLOCK_SIZE]; struct message_block block; ssize_t ret; lib_init(); parser = fts_parser_html.try_init(NULL, "text/html", NULL); i_assert(parser != NULL); i_zero(&block); while ((ret = read(STDIN_FILENO, buf, sizeof(buf))) > 0) { block.data = buf; block.size = ret; parser->v.more(parser, &block); if (write(STDOUT_FILENO, block.data, block.size) < 0) i_fatal("write(stdout) failed: %m"); } if (ret < 0) i_fatal("read(stdin) failed: %m"); for (;;) { block.size = 0; parser->v.more(parser, &block); if (block.size == 0) break; if (write(STDOUT_FILENO, block.data, block.size) < 0) i_fatal("write(stdout) failed: %m"); } lib_deinit(); return 0; }