Annotation of libaitwww/example/test.c, revision 1.1.2.2
1.1.2.1 misho 1: #include <stdio.h>
2: #include <stdlib.h>
3: #include <aitwww.h>
4:
5:
6: int
7: main()
8: {
1.1.2.2 ! misho 9: int ret;
! 10: cgi_t *cgi, *cgi1;
1.1.2.1 misho 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:
1.1.2.2 ! misho 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");
1.1.2.1 misho 35: /*
1.1.2.2 ! misho 36: printf("\n%s\n", www_getValue(cgi1, "oho"));
! 37: www_delPair(cgi1, "oho");
1.1.2.1 misho 38: */
39:
1.1.2.2 ! misho 40: www_closeCGI(&cgi1);
! 41:
1.1.2.1 misho 42: return 0;
43: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>