Annotation of embedaddon/miniupnpc/testupnpreplyparse.c, revision 1.1

1.1     ! misho       1: /* $Id: testupnpreplyparse.c,v 1.2 2008/02/21 13:05:27 nanard 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>