Annotation of libaitwww/example/test_url.c, revision 1.1.2.1
1.1.2.1 ! misho 1: /*
! 2: * Test URL API
! 3: *
! 4: * ./test_url "http://www.elwix.org/test/mda?ole=ssss&aaa=aa&sg=V&sgg=VV&piuk=pi3.14&vv=Mishka&z=z&sfsf=fd"
! 5: */
! 6: #include <stdio.h>
! 7: #include <string.h>
! 8: #include <aitwww.h>
! 9:
! 10:
! 11: int main(int argc, char **argv)
! 12: {
! 13: struct tagIOURL URL;
! 14: int ret = 0;
! 15: char szVal[BUFSIZ];
! 16: cgi_t *cgi;
! 17:
! 18: if (argc > 1) {
! 19: printf("URL:: Return=%x --- URL=%s\n", (ret = www_URLGet(argv[1], &URL)), argv[1]);
! 20:
! 21: printf("URL:: (%x) ***Line=%s\n", ret, URL.url_line);
! 22: printf("URL:: (%x) tech=%s(%d)\n", ret & 1, URL.url_tech.value, URL.url_tech.vallen);
! 23: printf("URL:: (%x) user=%s(%d)\n", ret & 2, URL.url_user.value, URL.url_user.vallen);
! 24: printf("URL:: (%x) pass=%s(%d)\n", ret & 4, URL.url_pass.value, URL.url_pass.vallen);
! 25: printf("URL:: (%x) host=%s(%d)\n", ret & 8, URL.url_host.value, URL.url_host.vallen);
! 26: printf("URL:: (%x) port=%s(%d)\n", ret & 16, URL.url_port.value, URL.url_port.vallen);
! 27: printf("URL:: (%x) path=%s(%d)\n", ret & 32, URL.url_path.value, URL.url_path.vallen);
! 28: printf("URL:: (%x) args=%s(%d)\n", ret & 64, URL.url_args.value, URL.url_args.vallen);
! 29: printf("URL:: (%x) +++reserved=%s\n", ret & 128, URL.url_reserved);
! 30:
! 31: memset(szVal, 0, BUFSIZ);
! 32: cgi = www_parseQuery(URL.url_args.value);
! 33: printf("Get_url:: %s Attribute=piuk\n", www_getValue(cgi, "piuk"));
! 34: printf("Get_url:: %s Attribute=sg\n", www_getValue(cgi, "sg"));
! 35: printf("Get_url:: %s Attribute=sgg\n", www_getValue(cgi, "sgg"));
! 36: printf("Get_url:: %s Attribute=sfsf\n", www_getValue(cgi, "sfsf"));
! 37: printf("Get_url:: %s Attribute=vv\n", www_getValue(cgi, "vv"));
! 38: printf("Get_url:: %s Attribute=vv\n", www_getValue(cgi, "vv"));
! 39: www_closeCGI(&cgi);
! 40:
! 41: printf("File_url:: File=%s %d\n", szVal, www_URLGetFile(&URL, szVal, BUFSIZ));
! 42: }
! 43:
! 44: return 0;
! 45: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>