File:
[ELWIX - Embedded LightWeight unIX -] /
libaitio /
example /
test.c
Revision
1.6:
download - view:
text,
annotated -
select for diffs -
revision graph
Thu Mar 15 01:52:22 2012 UTC (13 years, 1 month ago) by
misho
Branches:
MAIN
CVS tags:
io3_8,
io3_7,
io3_6,
io3_5,
io3_4,
io3_3,
io3_2,
io3_1,
io2_8,
io2_7,
io2_6,
io2_5,
IO3_7,
IO3_6,
IO3_5,
IO3_4,
IO3_3,
IO3_2,
IO3_1,
IO3_0,
IO2_7,
IO2_6,
IO2_5,
IO2_4,
HEAD
release version 2.4
#include <stdio.h>
#include <string.h>
#include <aitio.h>
int main(int argc, char **argv)
{
int ret;
char str[256], *s, s0[2][256];
if (argc < 2) {
printf("std:: %s ioPromptRead(NULL) -> %d\n", str, ioPromptRead(NULL, NULL, str, 256));
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,
ioPromptPassword(NULL, NULL, str, 256, 0));
printf("std:: %s ioPromptPassword(NULL) -> %d\n", str,
ioPromptPassword(NULL, NULL, str, 256, 1));
printf("std:: %s w/o confirm ioPromptPassword(PIUK> ) -> %d\n", str,
(ret = ioPromptPassword(NULL, "PIUK pass: ", str, 256, 0)));
printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
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 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));
s = ioRegexReplace("[0-9]+", "0shmink132sdf09", "XXX");
printf("regex:: ioRegexReplace([0-9]+) -> %s with XXX\n", s);
free(s);
s = ioRegexReplace("[0-9]+", "shmink132sdf09", NULL);
printf("regex:: ioRegexReplace([0-9]+) -> %s clear!\n", s);
free(s);
}
if (argc > 2) {
char *s1, *s2;
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);
printf( "1=%d\n", io_LTrimStr(argv[1]));
printf( "2=%d\n", io_RTrimStr(argv[2]));
printf( "3=%d\n", io_TrimStr(argv[3]));
printf("'%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
printf("test p=%s f=%s path2file=%d\n", s0[0], s0[1], io_Path2File(argv[2], s0[0], 256, s0[1], 256));
return 0;
}
return 0;
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>