Diff for /libelwix/example/test_find2replace.c between versions 1.1 and 1.1.2.1

version 1.1, 2024/10/26 14:24:07 version 1.1.2.1, 2024/10/26 14:24:07
Line 0 Line 1
   #include <stdio.h>
   #include <string.h>
   #include <elwix.h>
   
   
   int
   main(int argc, char **argv)
   {
           int mlen, hm;
           char *str;
           const char *cs = "ABCDEF123GHIJ321KL123MNOP123QRST122UWV123XYZ";
           const char *csb = "123ABCDEF123GHIJ321KL123MNOP123QRST122UWV123XYZ";
           const char *cse = "ABCDEF123GHIJ321KL123MNOP123QRST122UWV123XYZ123";
           const char *csn = "";
           const char *cso = "AB";
   
           hm = str_find2replace(cs, "123", NULL, NULL, NULL);
           printf("s&r howmany=%d only\n", hm);
   
           hm = str_find2replace(cs, "123", "*3245*", &str, &mlen);
           printf("s&r howmany=%d origin=%s new(%d)=%s\n", hm, cs, mlen, str);
           e_free(str);
           hm = str_find2replace(csb, "123", "*3245*", &str, &mlen);
           printf("s&r howmany=%d origin=%s new(%d)=%s\n", hm, csb, mlen, str);
           e_free(str);
           hm = str_find2replace(cse, "123", "*3245*", &str, &mlen);
           printf("s&r howmany=%d origin=%s new(%d)=%s\n", hm, cse, mlen, str);
           e_free(str);
           hm = str_find2replace(csn, "123", "*3245*", &str, &mlen);
           printf("s&r howmany=%d origin=%s new(%d)=%s\n", hm, csn, mlen, str);
           e_free(str);
           hm = str_find2replace(cso, "123", "*3245*", &str, &mlen);
           printf("s&r howmany=%d origin=%s new(%d)=%s\n", hm, cso, mlen, str);
           e_free(str);
   
           hm = str_find2replace(cs, "123", NULL, &str, &mlen);
           printf("s&e howmany=%d origin=%s new(%d)=%s\n", hm, cs, mlen, str);
           e_free(str);
   
           hm = str_find2replace(cs, "123", "*", &str, &mlen);
           printf("s&r howmany=%d origin=%s new(%d)=%s\n", hm, cs, mlen, str);
           e_free(str);
           return 0;
   }

Removed from v.1.1  
changed lines
  Added in v.1.1.2.1


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