Diff for /libaitcfg/src/Attic/tools.c between versions 1.2.4.4 and 1.3

version 1.2.4.4, 2010/03/22 15:05:14 version 1.3, 2010/03/22 14:53:49
Line 23  inline int ltrim(u_char *psLine) Line 23  inline int ltrim(u_char *psLine)
         if (!pos)          if (!pos)
                 return 0;                  return 0;
   
        memmove(psLine, psLine + pos, (strlen((char*) psLine) - pos) + 1);        memmove(psLine, psLine + pos, strlen((char*) psLine) - pos + 1);
         return pos;          return pos;
 }  }
   
 // rtrim() Right trim whitespaces  // rtrim() Right trim whitespaces
 inline int rtrim(u_char *psLine)  inline int rtrim(u_char *psLine)
 {  {
        register int i;        int i, pos = 0;
        int pos = 0; 
   
         if (!psLine)          if (!psLine)
                 return 0;                  return 0;
        for (i = strlen((char*) psLine) - 1; i; i--) {        for (i = strlen((char*) psLine); i; i--) {
                switch (psLine[i]) {                switch (psLine[i - 1]) {
                         case ' ':                          case ' ':
                         case '\t':                          case '\t':
                         case '\r':                          case '\r':
                         case '\n':                          case '\n':
                                psLine[i] = 0;                                psLine[i - 1] = 0;
                                 pos++;                                  pos++;
                                 continue;                                  continue;
                 }                  }
Line 62  inline int trim(u_char *psLine) Line 61  inline int trim(u_char *psLine)
         ret += rtrim(psLine);          ret += rtrim(psLine);
   
         return ret;          return ret;
 }  
   
 // unquot() Unquoted string  
 inline int unquot(u_char *psLine)  
 {  
         char *pos, *str = NULL;  
         int flg;  
   
         if (!psLine)  
                 return 0;  
   
         switch (*psLine) {  
                 case '`':  
                 case '"':  
                 case '\'':  
                         str = strdup((char*) psLine + 1);  
                         for (pos = str, flg = 0; *pos; flg = ('\\' == *pos), pos++) {  
                                 if (!flg && *pos == *psLine) {  
                                         *pos = 0;  
                                         strlcpy((char*) psLine, str, strlen((char*) psLine) + 1);  
                                         break;  
                                 }  
                         }  
                         free(str);  
                         return 1;  
         }  
   
         return 0;  
 }  }

Removed from v.1.2.4.4  
changed lines
  Added in v.1.3


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