File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / miniupnpc / testupnpreplyparse.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:16:22 2012 UTC (12 years, 10 months ago) by misho
Branches: miniupnpc, elwix, MAIN
CVS tags: v1_8p0, v1_8, v1_6, HEAD
miniupnpc

/* $Id: testupnpreplyparse.c,v 1.1.1.1 2012/02/21 23:16:22 misho Exp $ */
/* MiniUPnP project
 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
 * (c) 2006-2007 Thomas Bernard
 * This software is subject to the conditions detailed
 * in the LICENCE file provided within the distribution */
#include <stdio.h>
#include <stdlib.h>
#include "upnpreplyparse.h"

void
test_parsing(const char * buf, int len)
{
	struct NameValueParserData pdata;
	ParseNameValue(buf, len, &pdata);
	ClearNameValueList(&pdata);
}

int main(int argc, char * * argv)
{
	FILE * f;
	char buffer[4096];
	int l;
	if(argc<2)
	{
		fprintf(stderr, "Usage: %s file.xml\n", argv[0]);
		return 1;
	}
	f = fopen(argv[1], "r");
	if(!f)
	{
		fprintf(stderr, "Error : can not open file %s\n", argv[1]);
		return 2;
	}
	l = fread(buffer, 1, sizeof(buffer)-1, f);
	fclose(f);
	buffer[l] = '\0';
#ifdef DEBUG
	DisplayNameValueList(buffer, l);
#endif
	test_parsing(buffer, l);
	return 0;
}


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>