/*
 * This file is part of Sargasso, http://zamez.org/sargasso
 * Licensed under the GNU General Public License,
 *                http://www.opensource.org/licenses/gpl-license
 * Copyright 2006 James Bursa <james@zamez.org>
 */

#include <stdio.h>
#include "feed.h"


void die(const char *error);
void warn(const char *warning);


int main(int argc, char *argv[])
{
	unsigned int i;

	if (!feed_init())
		die(feed_error);

	if (!feed_add("file:///home/james/Projects/sargasso2/tests/bbc"))
		warn(feed_error);
	if (!feed_add("file:///home/james/Projects/sargasso2/tests/drobe"))
		warn(feed_error);
	if (!feed_add("file:///home/james/Projects/sargasso2/tests/ft"))
		warn(feed_error);
	if (!feed_add("file:///home/james/Projects/sargasso2/tests/iconbar"))
		warn(feed_error);
	if (!feed_add("file:///home/james/Projects/sargasso2/tests/reuters"))
		warn(feed_error);
	if (!feed_add("file:///home/james/Projects/sargasso2/tests/snackspot"))
		warn(feed_error);
	if (!feed_add("file:///home/james/Projects/sargasso2/tests/theregister"))
		warn(feed_error);
	if (!feed_add("http://zamez/"))
		warn(feed_error);
	if (!feed_add("http://zamez/temp"))
		warn(feed_error);
	if (!feed_add("http://zamez/perm"))
		warn(feed_error);

	while (feed_work_needed)
		feed_work();

	for (i = 0; i != feed_count; i++)
		feed_print(&feeds[i]);

	feed_update();

	while (feed_work_needed)
		feed_work();

	for (i = 0; i != feed_count; i++)
		feed_print(&feeds[i]);

	feed_quit();

	return 0;
}


void die(const char *error)
{
	fprintf(stderr, "%s\n", error);
	exit(EXIT_FAILURE);
}


void warn(const char *warning)
{
	fprintf(stderr, "%s\n", warning);
}
