Annotation of libaitio/example/test.c, revision 1.1.1.1.2.1
1.1 misho 1: #include <stdio.h>
2: #include <aitio.h>
3:
4:
1.1.1.1.2.1! misho 5: int main(int argc, char **argv)
1.1 misho 6: {
7: int ret;
8: char str[256], *s;
9:
1.1.1.1.2.1! misho 10: if (argc < 2) {
! 11: printf("std:: %s ioPromptRead(NULL) -> %d\n", str, ioPromptRead(NULL, NULL, str, 256));
! 12: printf("std:: %s ioPromptRead(PIUK> ) -> %d\n", str, (ret = ioPromptRead(NULL, "PIUK> ", str, 256)));
! 13: printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
! 14:
! 15: printf("std:: %s w/o confirm ioPromptPassword(NULL) -> %d\n", str,
! 16: ioPromptPassword(NULL, NULL, str, 256, 0));
! 17: printf("std:: %s ioPromptPassword(NULL) -> %d\n", str,
! 18: ioPromptPassword(NULL, NULL, str, 256, 1));
! 19: printf("std:: %s w/o confirm ioPromptPassword(PIUK> ) -> %d\n", str,
! 20: (ret = ioPromptPassword(NULL, "PIUK pass: ", str, 256, 0)));
! 21: printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
! 22:
! 23: printf("std:: %s ioPromptRead(FLIUP: ) -> %d\n", str, (ret = ioPromptRead(NULL, "FLIUP: ", str, 256)));
! 24:
! 25: printf("regex:: %s ioRegexVerify([0-9]+) -> %s\n", str, ioRegexVerify("[0-9]+", "shmink132sdf09", NULL, NULL));
! 26: printf("regex:: %s ioRegexGet([0-9]+) -> %d\n", str, ioRegexGet("[0-9]+", "shmink132sdf09", str, 256));
! 27: printf("regex:: %s not match ioRegexGet([ab]+) -> %d\n", str, ioRegexGet("[ab]+", "shmink132sdf09", str, 256));
! 28:
! 29: s = ioRegexReplace("[0-9]+", "0shmink132sdf09", "XXX");
! 30: printf("regex:: ioRegexReplace([0-9]+) -> %s with XXX\n", s);
! 31: free(s);
! 32: s = ioRegexReplace("[0-9]+", "shmink132sdf09", NULL);
! 33: printf("regex:: ioRegexReplace([0-9]+) -> %s clear!\n", s);
! 34: free(s);
! 35: }
! 36:
! 37: if (argc > 1) {
! 38: struct tagIOURL URL;
! 39: int ret = 0;
! 40:
! 41: printf("URL:: Return=%x --- URL=%s\n", (ret = ioURLGet(argv[1], &URL)), argv[1]);
! 42:
! 43: printf("URL:: (%x) ***Line=%s\n", ret, URL.url_line);
! 44: printf("URL:: (%x) tech=%s(%d)\n", ret & 1, URL.url_tech.value, URL.url_tech.vallen);
! 45: printf("URL:: (%x) user=%s(%d)\n", ret & 2, URL.url_user.value, URL.url_user.vallen);
! 46: printf("URL:: (%x) pass=%s(%d)\n", ret & 4, URL.url_pass.value, URL.url_pass.vallen);
! 47: printf("URL:: (%x) host=%s(%d)\n", ret & 8, URL.url_host.value, URL.url_host.vallen);
! 48: printf("URL:: (%x) port=%s(%d)\n", ret & 16, URL.url_port.value, URL.url_port.vallen);
! 49: printf("URL:: (%x) path=%s(%d)\n", ret & 32, URL.url_path.value, URL.url_path.vallen);
! 50: printf("URL:: (%x) args=%s(%d)\n", ret & 64, URL.url_args.value, URL.url_args.vallen);
! 51: printf("URL:: (%x) +++reserved=%s\n", ret & 128, URL.url_reserved);
! 52: }
1.1 misho 53: return 0;
54: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>