File:  [ELWIX - Embedded LightWeight unIX -] / libelwix / example / test.c
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Thu Jan 17 10:05:35 2013 UTC (11 years, 4 months ago) by misho
Branches: MAIN
CVS tags: HEAD
Initial revision

    1: #include <stdio.h>
    2: #include <string.h>
    3: #include <elwix.h>
    4: 
    5: 
    6: int main(int argc, char **argv)
    7: {
    8: 	int ret;
    9: 	char str[256], *s, s0[2][256];
   10: 	ait_val_t *v;
   11: 
   12: 	if (argc < 2) {
   13: 		printf("regex:: regex_Verify([0-9]+) -> %s\n", 
   14: 				regex_Verify("[0-9]+", "shmink132sdf09", NULL, NULL));
   15: 		printf("regex:: %s regex_Get([0-9]+) -> %d\n", str, 
   16: 				regex_Get("[0-9]+", "shmink132sdf09", str, sizeof str));
   17: 		printf("regex:: %s not match regex_Get([ab]+) -> %d\n", str, 
   18: 				regex_Get("[ab]+", "shmink132sdf09", str, sizeof str));
   19: 
   20: 		s = regex_Replace("[0-9]+", "0shmink132sdf09", "XXX");
   21: 		printf("regex:: regex_Replace([0-9]+) -> %s with XXX\n", s);
   22: 		e_free(s);
   23: 		s = regex_Replace("[0-9]+", "shmink132sdf09", NULL);
   24: 		printf("regex:: regex_Replace([0-9]+) -> %s clear!\n", s);
   25: 		e_free(s);
   26: 	}
   27: 
   28: 	if (argc > 2) {
   29: 		char *s2;
   30: 
   31: 		v = str_Hex2Dig("PIUK_GN IAH");
   32: 		printf("S1=%s\n", AIT_GET_LIKE(v, char*));
   33: 		ait_freeVar(&v);
   34: 		v = str_Hex2Dig(argv[1]);
   35: 		printf("%s S1=%s\n", argv[1], AIT_GET_LIKE(v, char*));
   36: 		s2 = str_Dig2Hex(v);
   37: 		printf("S2=%s\n", s2);
   38: 		if (s2)
   39: 			e_free(s2);
   40: 		ait_freeVar(&v);
   41: 
   42: 		printf( "1=%d\n", str_LTrim(argv[1]));
   43: 		printf( "2=%d\n", str_RTrim(argv[2]));
   44: 		printf( "3=%d\n", str_Trim(argv[3]));
   45: 		printf("'%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
   46: 		printf("test p=%s f=%s path2file=%d\n", s0[0], s0[1], 
   47: 				av_Path2File(argv[2], s0[0], 256, s0[1], 256));
   48: 		return 0;
   49: 	}
   50: 
   51: 	return 0;
   52: }

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