--- libaitio/example/test.c 2011/04/20 22:56:32 1.5 +++ libaitio/example/test.c 2012/11/15 23:23:54 1.7 @@ -29,10 +29,10 @@ int main(int argc, char **argv) s = ioRegexReplace("[0-9]+", "0shmink132sdf09", "XXX"); printf("regex:: ioRegexReplace([0-9]+) -> %s with XXX\n", s); - free(s); + io_free(s); s = ioRegexReplace("[0-9]+", "shmink132sdf09", NULL); printf("regex:: ioRegexReplace([0-9]+) -> %s clear!\n", s); - free(s); + io_free(s); } if (argc > 2) { @@ -41,8 +41,8 @@ int main(int argc, char **argv) s1 = io_Ch2Hex("PIUK_GN IAH", 256); s2 = io_Hex2Ch((unsigned char*) s1, strlen(s1)); printf("S1=%s S2=%s\n", s1, s2); - free(s2); - free(s1); + io_free(s2); + io_free(s1); printf( "1=%d\n", io_LTrimStr(argv[1])); printf( "2=%d\n", io_RTrimStr(argv[2])); @@ -52,47 +52,5 @@ int main(int argc, char **argv) return 0; } - if (argc > 1) { - struct tagIOURL URL; - int ret = 0; - array_t *item = NULL; - char szVal[BUFSIZ]; - - printf("URL:: Return=%x --- URL=%s\n", (ret = ioURLGet(argv[1], &URL)), argv[1]); - - printf("URL:: (%x) ***Line=%s\n", ret, URL.url_line); - printf("URL:: (%x) tech=%s(%d)\n", ret & 1, URL.url_tech.value, URL.url_tech.vallen); - printf("URL:: (%x) user=%s(%d)\n", ret & 2, URL.url_user.value, URL.url_user.vallen); - printf("URL:: (%x) pass=%s(%d)\n", ret & 4, URL.url_pass.value, URL.url_pass.vallen); - printf("URL:: (%x) host=%s(%d)\n", ret & 8, URL.url_host.value, URL.url_host.vallen); - printf("URL:: (%x) port=%s(%d)\n", ret & 16, URL.url_port.value, URL.url_port.vallen); - printf("URL:: (%x) path=%s(%d)\n", ret & 32, URL.url_path.value, URL.url_path.vallen); - printf("URL:: (%x) args=%s(%d)\n", ret & 64, URL.url_args.value, URL.url_args.vallen); - printf("URL:: (%x) +++reserved=%s\n", ret & 128, URL.url_reserved); - - printf("URL:: Get argsNum=%d\n", io_argsNum(URL.url_args.value, "&")); - - memset(szVal, 0, BUFSIZ); - printf("Get_url:: %s Attribute=piuk %d\n", szVal, ioURLGetValue(&URL, "piuk", szVal, BUFSIZ)); - printf("Get_url:: %s Attribute=sg %d\n", szVal, ioURLGetValue(&URL, "sg", szVal, BUFSIZ)); - printf("Get_url:: %s Attribute=sgg %d\n", szVal, ioURLGetValue(&URL, "sgg", szVal, BUFSIZ)); - printf("Get_url:: %s Attribute=sfsf %d\n", szVal, ioURLGetValue(&URL, "sfsf", NULL, BUFSIZ)); - printf("Get_url:: %s Attribute=vv %d\n", szVal, ioURLGetValue(&URL, "vv", NULL, 0)); - printf("Get_url:: %s Attribute=vv %d\n", szVal, ioURLGetValue(&URL, "vv", szVal, BUFSIZ)); - - printf("File_url:: File=%s %d\n", szVal, ioURLGetFile(&URL, szVal, BUFSIZ)); - - printf("URL:: array args=%d\n", io_arrayMake(URL.url_args.value, 4, "&", &item)); - for (ret = 0; ret < 4 && item->arr_data[ret]; ret++) - printf("array:: item[%d]=%s\n", ret, item->arr_data[ret]); - if (item) - io_arrayDestroy(&item); - - printf("URL:: array path=%d\n", io_arrayMake(URL.url_path.value, 2, "/", &item)); - for (ret = 0; ret < 2 && item->arr_data[ret]; ret++) - printf("array:: item[%d]=%s\n", ret, item->arr_data[ret]); - if (item) - io_arrayDestroy(&item); - } return 0; }