Diff for /libaitio/src/aitio.c between versions 1.2 and 1.2.2.2

version 1.2, 2010/09/10 12:39:41 version 1.2.2.2, 2011/02/10 19:45:07
Line 354  end: Line 354  end:
         return cx;          return cx;
 }  }
   
   
   /*
    * ioVarAst() Function for evaluate string like asterisk variable "{text[:[-]#[:#]]}"
    * @csString = Input string
    * return: NULL error, !=NULL Allocated new string evaluated from input string, must be free()
   */
   char *
   ioVarAst(const char *csString)
   {
           char *ext, *str, *out = NULL;
           int e[2] = { 0 };
   
           if (!csString)
                   return NULL;
   
           if (!strchr(csString, '{') || !strrchr(csString, '}')) {
                   memset(io_Error, 0, STRSIZ);
                   snprintf(io_Error, STRSIZ, "Error:: Invalid input string format ... "
                                   "must be like {text[:[-]#[:#]]}");
                   io_Errno = EINVAL;
                   return NULL;
           } else {
                   str = strdup(strchr(csString, '{') + 1);
                   *strrchr(str, '}') = 0;
           }
   
           if ((ext = strchr(str, ':'))) {
                   *ext++ = 0;
                   e[0] = strtol(ext, NULL, 0);
                   if ((ext = strchr(ext, ':')))
                           e[1] = strtol(++ext, NULL, 0);
   
                   /* make cut prefix */
                   if (e[0] >= 0)
                           ext = str + e[0];
                   else
                           ext = str + strlen(str) + e[0];
                   /* make cut suffix */
                   if (e[1] > 0)
                           *(ext + e[1]) = 0;
           } else
                   /* ok, clear show */
                   ext = str;
   
           out = strdup(ext);
           free(str);
   
           return out;
   }

Removed from v.1.2  
changed lines
  Added in v.1.2.2.2


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