File:  [ELWIX - Embedded LightWeight unIX -] / libaitwww / example / test.c
Revision 1.1.2.2: download - view: text, annotated - select for diffs - revision graph
Fri Mar 9 10:03:21 2012 UTC (12 years, 3 months ago) by misho
Branches: www1_0
fix bug related to www_delPair(). founded by Unit test

    1: #include <stdio.h>
    2: #include <stdlib.h>
    3: #include <aitwww.h>
    4: 
    5: 
    6: int
    7: main()
    8: {
    9: 	int ret;
   10: 	cgi_t *cgi, *cgi1;
   11: 
   12: 	putenv("QUERY_STRING=test1=abra+kadabra&testche=piuk%20mdaa");
   13: 	putenv("CONENT_LENGTH=390");
   14: 	putenv("REQUEST_METHOD=GET");
   15: 	cgi = www_initCGI();
   16: 	if (!cgi) {
   17: 		printf("Error:: #%d - %s\n", www_GetErrno(), www_GetError());
   18: 		return 1;
   19: 	}
   20: 
   21: 	printf("%s\n%s\n", www_getValue(cgi, "testche"), www_getValue(cgi, "test1"));
   22: 	cgi1 = www_parseQuery("blahA=this is a string&blahB=this is another string");
   23: 	if (!cgi1) {
   24: 		printf("Error:: #%d - %s\n", www_GetErrno(), www_GetError());
   25: 		www_closeCGI(&cgi);
   26: 		return 2;
   27: 	}
   28: 	printf("\n%s\n%s\n", www_getValue(cgi1, "blahA"), www_getValue(cgi1, "blahB"));
   29: 
   30: 	www_closeCGI(&cgi);
   31: 
   32: 	www_addValue(cgi1, "oho", "boho");
   33: 	printf("\n%s\n", www_getValue(cgi1, "oho"));
   34: 	www_delPair(cgi1, "oho");
   35: 	/*
   36: 	printf("\n%s\n", www_getValue(cgi1, "oho"));
   37: 	www_delPair(cgi1, "oho");
   38: 	*/
   39: 
   40: 	www_closeCGI(&cgi1);
   41: 
   42: 	return 0;
   43: }

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