Diff for /libaitio/example/test.c between versions 1.1.1.1 and 1.1.1.1.2.3

version 1.1.1.1, 2010/02/23 22:54:52 version 1.1.1.1.2.3, 2010/03/04 09:54:23
Line 2 Line 2
 #include <aitio.h>  #include <aitio.h>
   
   
int main()int main(int argc, char **argv)
 {  {
         int ret;          int ret;
         char str[256], *s;          char str[256], *s;
   
        printf("std:: %s ioPromptRead(NULL) -> %d\n", str, ioPromptRead(NULL, NULL, str, 256));        if (argc < 2) {
        printf("std:: %s ioPromptRead(PIUK> ) -> %d\n", str, (ret = ioPromptRead(NULL, "PIUK> ", str, 256)));                printf("std:: %s ioPromptRead(NULL) -> %d\n", str, ioPromptRead(NULL, NULL, str, 256));
        printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());                printf("std:: %s ioPromptRead(PIUK> ) -> %d\n", str, (ret = ioPromptRead(NULL, "PIUK> ", str, 256)));
                 printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
   
        printf("std:: %s w/o confirm ioPromptPassword(NULL) -> %d\n", str,                 printf("std:: %s w/o confirm ioPromptPassword(NULL) -> %d\n", str, 
                        ioPromptPassword(NULL, NULL, str, 256, 0));                                ioPromptPassword(NULL, NULL, str, 256, 0));
        printf("std:: %s ioPromptPassword(NULL) -> %d\n", str,                 printf("std:: %s ioPromptPassword(NULL) -> %d\n", str, 
                        ioPromptPassword(NULL, NULL, str, 256, 1));                                ioPromptPassword(NULL, NULL, str, 256, 1));
        printf("std:: %s w/o confirm ioPromptPassword(PIUK> ) -> %d\n", str,                 printf("std:: %s w/o confirm ioPromptPassword(PIUK> ) -> %d\n", str, 
                        (ret = ioPromptPassword(NULL, "PIUK pass: ", str, 256, 0)));                                (ret = ioPromptPassword(NULL, "PIUK pass: ", str, 256, 0)));
        printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());                printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
   
        printf("std:: %s ioPromptRead(FLIUP: ) -> %d\n", str, (ret = ioPromptRead(NULL, "FLIUP: ", str, 256)));                printf("std:: %s ioPromptRead(FLIUP: ) -> %d\n", str, (ret = ioPromptRead(NULL, "FLIUP: ", str, 256)));
   
        printf("regex:: %s ioRegexVerify([0-9]+) -> %s\n", str, ioRegexVerify("[0-9]+", "shmink132sdf09", NULL, NULL));                printf("regex:: %s ioRegexVerify([0-9]+) -> %s\n", str, ioRegexVerify("[0-9]+", "shmink132sdf09", NULL, NULL));
        printf("regex:: %s ioRegexGet([0-9]+) -> %d\n", str, ioRegexGet("[0-9]+", "shmink132sdf09", str, 256));                printf("regex:: %s ioRegexGet([0-9]+) -> %d\n", str, ioRegexGet("[0-9]+", "shmink132sdf09", str, 256));
        printf("regex:: %s not match ioRegexGet([ab]+) -> %d\n", str, ioRegexGet("[ab]+", "shmink132sdf09", str, 256));                printf("regex:: %s not match ioRegexGet([ab]+) -> %d\n", str, ioRegexGet("[ab]+", "shmink132sdf09", str, 256));
   
        s = ioRegexReplace("[0-9]+", "0shmink132sdf09", "XXX");                s = ioRegexReplace("[0-9]+", "0shmink132sdf09", "XXX");
        printf("regex:: ioRegexReplace([0-9]+) -> %s with XXX\n", s);                printf("regex:: ioRegexReplace([0-9]+) -> %s with XXX\n", s);
        free(s);                free(s);
        s = ioRegexReplace("[0-9]+", "shmink132sdf09", NULL);                s = ioRegexReplace("[0-9]+", "shmink132sdf09", NULL);
        printf("regex:: ioRegexReplace([0-9]+) -> %s clear!\n", s);                printf("regex:: ioRegexReplace([0-9]+) -> %s clear!\n", s);
        free(s);                free(s);
         }
   
           if (argc > 1) {
                   struct tagIOURL URL;
                   int ret = 0;
                   char **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 sizeofArray=%d\n", io_SizeArray(URL.url_args.value, "&"));
   
                   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("URL:: array args=%d\n", io_MakeArray(URL.url_args.value, "&", &item, 4));
                   for (ret = 0; ret < 4 && item; ret++)
                           printf("array:: item[%d]=%s\n", ret, item[ret]);
                   if (item)
                           free(item);
   
                   printf("URL:: array path=%d\n", io_MakeArray(URL.url_path.value, "/", &item, 2));
                   for (ret = 0; ret < 2 && item; ret++)
                           printf("array:: item[%d]=%s\n", ret, item[ret]);
                   if (item)
                           free(item);
           }
         return 0;          return 0;
 }  }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.1.2.3


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