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, 3 months ago) by misho
Branches: miniupnpc, elwix, MAIN
CVS tags: v1_8p0, v1_8, v1_6, HEAD
miniupnpc

    1: /* $Id: testupnpreplyparse.c,v 1.1.1.1 2012/02/21 23:16:22 misho Exp $ */
    2: /* MiniUPnP project
    3:  * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
    4:  * (c) 2006-2007 Thomas Bernard
    5:  * This software is subject to the conditions detailed
    6:  * in the LICENCE file provided within the distribution */
    7: #include <stdio.h>
    8: #include <stdlib.h>
    9: #include "upnpreplyparse.h"
   10: 
   11: void
   12: test_parsing(const char * buf, int len)
   13: {
   14: 	struct NameValueParserData pdata;
   15: 	ParseNameValue(buf, len, &pdata);
   16: 	ClearNameValueList(&pdata);
   17: }
   18: 
   19: int main(int argc, char * * argv)
   20: {
   21: 	FILE * f;
   22: 	char buffer[4096];
   23: 	int l;
   24: 	if(argc<2)
   25: 	{
   26: 		fprintf(stderr, "Usage: %s file.xml\n", argv[0]);
   27: 		return 1;
   28: 	}
   29: 	f = fopen(argv[1], "r");
   30: 	if(!f)
   31: 	{
   32: 		fprintf(stderr, "Error : can not open file %s\n", argv[1]);
   33: 		return 2;
   34: 	}
   35: 	l = fread(buffer, 1, sizeof(buffer)-1, f);
   36: 	fclose(f);
   37: 	buffer[l] = '\0';
   38: #ifdef DEBUG
   39: 	DisplayNameValueList(buffer, l);
   40: #endif
   41: 	test_parsing(buffer, l);
   42: 	return 0;
   43: }
   44: 

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