File:  [ELWIX - Embedded LightWeight unIX -] / libaitio / example / test.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 23 22:54:52 2010 UTC (14 years, 4 months ago) by misho
Branches: start
CVS tags: misho, io1_0
libaitio for I/O console operations

    1: #include <stdio.h>
    2: #include <aitio.h>
    3: 
    4: 
    5: int main()
    6: {
    7: 	int ret;
    8: 	char str[256], *s;
    9: 
   10: 	printf("std:: %s ioPromptRead(NULL) -> %d\n", str, ioPromptRead(NULL, NULL, str, 256));
   11: 	printf("std:: %s ioPromptRead(PIUK> ) -> %d\n", str, (ret = ioPromptRead(NULL, "PIUK> ", str, 256)));
   12: 	printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
   13: 
   14: 	printf("std:: %s w/o confirm ioPromptPassword(NULL) -> %d\n", str, 
   15: 			ioPromptPassword(NULL, NULL, str, 256, 0));
   16: 	printf("std:: %s ioPromptPassword(NULL) -> %d\n", str, 
   17: 			ioPromptPassword(NULL, NULL, str, 256, 1));
   18: 	printf("std:: %s w/o confirm ioPromptPassword(PIUK> ) -> %d\n", str, 
   19: 			(ret = ioPromptPassword(NULL, "PIUK pass: ", str, 256, 0)));
   20: 	printf("geterror:: #%d - %s\n", io_GetErrno(), io_GetError());
   21: 
   22: 	printf("std:: %s ioPromptRead(FLIUP: ) -> %d\n", str, (ret = ioPromptRead(NULL, "FLIUP: ", str, 256)));
   23: 
   24: 	printf("regex:: %s ioRegexVerify([0-9]+) -> %s\n", str, ioRegexVerify("[0-9]+", "shmink132sdf09", NULL, NULL));
   25: 	printf("regex:: %s ioRegexGet([0-9]+) -> %d\n", str, ioRegexGet("[0-9]+", "shmink132sdf09", str, 256));
   26: 	printf("regex:: %s not match ioRegexGet([ab]+) -> %d\n", str, ioRegexGet("[ab]+", "shmink132sdf09", str, 256));
   27: 
   28: 	s = ioRegexReplace("[0-9]+", "0shmink132sdf09", "XXX");
   29: 	printf("regex:: ioRegexReplace([0-9]+) -> %s with XXX\n", s);
   30: 	free(s);
   31: 	s = ioRegexReplace("[0-9]+", "shmink132sdf09", NULL);
   32: 	printf("regex:: ioRegexReplace([0-9]+) -> %s clear!\n", s);
   33: 	free(s);
   34: 
   35: 	return 0;
   36: }

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