File:
[ELWIX - Embedded LightWeight unIX -] /
libaitio /
example /
test.c
Revision
1.7:
download - view:
text,
annotated -
select for diffs -
revision graph
Thu Nov 15 23:23:54 2012 UTC (11 years, 10 months ago) by
misho
Branches:
MAIN
CVS tags:
io5_0,
io4_1,
io4_0,
io3_9,
IO4_1,
IO4_0,
IO3_9,
IO3_8,
HEAD
version 3.8
1: #include <stdio.h>
2: #include <string.h>
3: #include <aitio.h>
4:
5:
6: int main(int argc, char **argv)
7: {
8: int ret;
9: char str[256], *s, s0[2][256];
10:
11: if (argc < 2) {
12: printf("std:: %s ioPromptRead(NULL) -> %d\n", str, ioPromptRead(NULL, NULL, str, 256));
13: printf("std:: %s ioPromptRead(PIUK> ) -> %d\n", str, (ret = ioPromptRead(NULL, "PIUK> ", str, 256)));
14: printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
15:
16: printf("std:: %s w/o confirm ioPromptPassword(NULL) -> %d\n", str,
17: ioPromptPassword(NULL, NULL, str, 256, 0));
18: printf("std:: %s ioPromptPassword(NULL) -> %d\n", str,
19: ioPromptPassword(NULL, NULL, str, 256, 1));
20: printf("std:: %s w/o confirm ioPromptPassword(PIUK> ) -> %d\n", str,
21: (ret = ioPromptPassword(NULL, "PIUK pass: ", str, 256, 0)));
22: printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
23:
24: printf("std:: %s ioPromptRead(FLIUP: ) -> %d\n", str, (ret = ioPromptRead(NULL, "FLIUP: ", str, 256)));
25:
26: printf("regex:: %s ioRegexVerify([0-9]+) -> %s\n", str, ioRegexVerify("[0-9]+", "shmink132sdf09", NULL, NULL));
27: printf("regex:: %s ioRegexGet([0-9]+) -> %d\n", str, ioRegexGet("[0-9]+", "shmink132sdf09", str, 256));
28: printf("regex:: %s not match ioRegexGet([ab]+) -> %d\n", str, ioRegexGet("[ab]+", "shmink132sdf09", str, 256));
29:
30: s = ioRegexReplace("[0-9]+", "0shmink132sdf09", "XXX");
31: printf("regex:: ioRegexReplace([0-9]+) -> %s with XXX\n", s);
32: io_free(s);
33: s = ioRegexReplace("[0-9]+", "shmink132sdf09", NULL);
34: printf("regex:: ioRegexReplace([0-9]+) -> %s clear!\n", s);
35: io_free(s);
36: }
37:
38: if (argc > 2) {
39: char *s1, *s2;
40:
41: s1 = io_Ch2Hex("PIUK_GN IAH", 256);
42: s2 = io_Hex2Ch((unsigned char*) s1, strlen(s1));
43: printf("S1=%s S2=%s\n", s1, s2);
44: io_free(s2);
45: io_free(s1);
46:
47: printf( "1=%d\n", io_LTrimStr(argv[1]));
48: printf( "2=%d\n", io_RTrimStr(argv[2]));
49: printf( "3=%d\n", io_TrimStr(argv[3]));
50: printf("'%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
51: printf("test p=%s f=%s path2file=%d\n", s0[0], s0[1], io_Path2File(argv[2], s0[0], 256, s0[1], 256));
52: return 0;
53: }
54:
55: return 0;
56: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>