Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for libplaton/platon/str/strplus.c between version 1.18 and 1.19

version 1.18, 2002/08/16 20:31:43 version 1.19, 2002/08/27 13:12:33
Line 10 
Line 10 
 #include "strplus.h"  #include "strplus.h"
 #include "strctype.h"  #include "strctype.h"
   
 #ifndef FUNCTION  
 #  define FUNCTION_NAME(_unused, _name) _unused##_name  
 #  define FUNCTION(_name) FUNCTION_NAME(, ## _name)  
 #endif  
   
         char *          char *
 FUNCTION(strestr)(s1, s2)  PLATON_FUNC(strestr)(s1, s2)
         const char *s1;          const char *s1;
         const char *s2;          const char *s2;
 {  {
Line 32  FUNCTION(strestr)(s1, s2)
Line 27  FUNCTION(strestr)(s1, s2)
  */   */
   
         char *          char *
 FUNCTION(stristr)(s1, s2)  PLATON_FUNC(stristr)(s1, s2)
         const char *s1;          const char *s1;
         const char *s2;          const char *s2;
 {  {
Line 52  FUNCTION(stristr)(s1, s2)
Line 47  FUNCTION(stristr)(s1, s2)
                 return NULL;                  return NULL;
         }          }
   
         if ((ret = strstr(FUNCTION(strtolower)(a_s1), FUNCTION(strtoupper)(a_s2))) != NULL)          if ((ret = strstr(PLATON_FUNC(strtolower)(a_s1), PLATON_FUNC(strtoupper)(a_s2))) != NULL)
                 ret = (char *) s1 + (ret - a_s1);                  ret = (char *) s1 + (ret - a_s1);
   
         free(a_s1);          free(a_s1);
Line 64  FUNCTION(stristr)(s1, s2)
Line 59  FUNCTION(stristr)(s1, s2)
 #endif  #endif
   
         char *          char *
 FUNCTION(str_white_str)(str, substr, size)  PLATON_FUNC(str_white_str)(str, substr, size)
         char *str;          char *str;
         char *substr;          char *substr;
         int  *size;          int  *size;
Line 149  FUNCTION(str_white_str)(str, substr, siz
Line 144  FUNCTION(str_white_str)(str, substr, siz
   
   
         int          int
 FUNCTION(strcnt)(str, c)  PLATON_FUNC(strcnt)(str, c)
         const char *str;          const char *str;
         const int c;          const int c;
 {  {
Line 164  FUNCTION(strcnt)(str, c)
Line 159  FUNCTION(strcnt)(str, c)
 }  }
   
         int          int
 FUNCTION(strcnt_str)(str, substr)  PLATON_FUNC(strcnt_str)(str, substr)
         const char *str;          const char *str;
         const char *substr;          const char *substr;
 {  {
Line 182  FUNCTION(strcnt_str)(str, substr)
Line 177  FUNCTION(strcnt_str)(str, substr)
 }  }
   
         int          int
 FUNCTION(strcnt_sepstr)(str, substr)  PLATON_FUNC(strcnt_sepstr)(str, substr)
         const char *str;          const char *str;
         const char *substr;          const char *substr;
 {  {
Line 202  FUNCTION(strcnt_sepstr)(str, substr)
Line 197  FUNCTION(strcnt_sepstr)(str, substr)
 }  }
   
         char *          char *
 FUNCTION(strdel)(s)  PLATON_FUNC(strdel)(s)
         char *s;          char *s;
 {  {
         register int i;          register int i;
Line 215  FUNCTION(strdel)(s)
Line 210  FUNCTION(strdel)(s)
 }  }
   
         char *          char *
 FUNCTION(strrmlf)(s)  PLATON_FUNC(strrmlf)(s)
         char *s;          char *s;
 {  {
         register char *p_lf;          register char *p_lf;
   
         while ((p_lf = strchr(s, '\n')) != NULL)          while ((p_lf = strchr(s, '\n')) != NULL)
                 FUNCTION(strdel)(p_lf);                  PLATON_FUNC(strdel)(p_lf);
   
         return s;          return s;
 }  }
   
         char *          char *
 FUNCTION(strrmcr)(s)  PLATON_FUNC(strrmcr)(s)
         char *s;          char *s;
 {  {
         register char *p_cr;          register char *p_cr;
   
         while ((p_cr = strchr(s, '\r')) != NULL)          while ((p_cr = strchr(s, '\r')) != NULL)
                 FUNCTION(strdel)(p_cr);                  PLATON_FUNC(strdel)(p_cr);
   
         return s;          return s;
 }  }
   
         char *          char *
 FUNCTION(str_left_trim)(s)  PLATON_FUNC(str_left_trim)(s)
         char *s;          char *s;
 {  {
         register char *pos;          register char *pos;
Line 253  FUNCTION(str_left_trim)(s)
Line 248  FUNCTION(str_left_trim)(s)
 }  }
   
         char *          char *
 FUNCTION(str_right_trim)(s)  PLATON_FUNC(str_right_trim)(s)
         char *s;          char *s;
 {  {
         register char *pos;          register char *pos;
Line 266  FUNCTION(str_right_trim)(s)
Line 261  FUNCTION(str_right_trim)(s)
 }  }
   
         char *          char *
 FUNCTION(str_trim_whitechars)(s)  PLATON_FUNC(str_trim_whitechars)(s)
         char *s;          char *s;
 {  {
         register char *pos, *start;          register char *pos, *start;
Line 294  FUNCTION(str_trim_whitechars)(s)
Line 289  FUNCTION(str_trim_whitechars)(s)
 }  }
   
         char *          char *
 FUNCTION(strins)(str, ins)  PLATON_FUNC(strins)(str, ins)
         char *str;          char *str;
         char *ins;          char *ins;
 {  {
Line 307  FUNCTION(strins)(str, ins)
Line 302  FUNCTION(strins)(str, ins)
 }  }
   
         int          int
 FUNCTION(strrcmp)(s1, s2)  PLATON_FUNC(strrcmp)(s1, s2)
         const char *s1;          const char *s1;
         const char *s2;          const char *s2;
 {  {
Line 336  FUNCTION(strrcmp)(s1, s2)
Line 331  FUNCTION(strrcmp)(s1, s2)
   
 #define TESTSTR2 " \t  AAA\nBBBB__C   D\taDa D \t   \t"  #define TESTSTR2 " \t  AAA\nBBBB__C   D\taDa D \t   \t"
   
 void strins_selftest(void) {  static void strins_selftest(void) {
         char long_str[80];          char long_str[80];
   
 #define SEARCH_STR      "56"  #define SEARCH_STR      "56"
Line 366  main(argc, argv)
Line 361  main(argc, argv)
         if (argc > 2) {          if (argc > 2) {
                 int size;                  int size;
   
                 str2 = str_white_str(argv[1], argv[2], &size);                  str2 = PLATON_FUNC(str_white_str)(argv[1], argv[2], &size);
                 /* str2 = str_white_str("telnet \t atlantis.sk  5678", "t  a", &size);                  /* str2 = str_white_str("telnet \t atlantis.sk  5678", "t  a", &size);
                  */                   */
                 printf("  ptr = [%s], size = %d\n", str2, size);                  printf("  ptr = [%s], size = %d\n", str2, size);
Line 380  main(argc, argv)
Line 375  main(argc, argv)
   
         printf("strcnt(\"%s\", '%c') = %d\n",          printf("strcnt(\"%s\", '%c') = %d\n",
                         TESTSTR1, TESTSEP1,                          TESTSTR1, TESTSEP1,
                         strcnt(TESTSTR1, TESTSEP1));                          PLATON_FUNC(strcnt)(TESTSTR1, TESTSEP1));
   
         printf("strcnt_str(\"%s\", \"%s\") = %d\n",          printf("strcnt_str(\"%s\", \"%s\") = %d\n",
                         TESTSTR1, TESTSEP2,                          TESTSTR1, TESTSEP2,
                         strcnt_str(TESTSTR1, TESTSEP2));                          PLATON_FUNC(strcnt_str)(TESTSTR1, TESTSEP2));
   
         printf("strcnt_sepstr(\"%s\", \"%s\") = %d\n",          printf("strcnt_sepstr(\"%s\", \"%s\") = %d\n",
                         TESTSTR1, TESTSEP2,                          TESTSTR1, TESTSEP2,
                         strcnt_sepstr(TESTSTR1, TESTSEP2));                          PLATON_FUNC(strcnt_sepstr)(TESTSTR1, TESTSEP2));
   
         printf("str_trim_whitechars(\"%s\") = \"%s\"\n",          printf("str_trim_whitechars(\"%s\") = \"%s\"\n",
                         TESTSTR2, str_trim_whitechars(str2));                          TESTSTR2,
                           PLATON_FUNC(str_trim_whitechars)(str2));
   
         free(str2);          free(str2);
   
Line 401  main(argc, argv)
Line 397  main(argc, argv)
         return 0;          return 0;
 }  }
   
 #endif  #endif /* #if defined(SELF) || defined(SELFTEST) || defined(SELF_STRPLUS) */
   

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top