--- libaitio/src/Attic/array.c 2012/07/30 10:55:51 1.10.6.2 +++ libaitio/src/Attic/array.c 2012/07/30 11:49:46 1.10.6.5 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: array.c,v 1.10.6.2 2012/07/30 10:55:51 misho Exp $ +* $Id: array.c,v 1.10.6.5 2012/07/30 11:49:46 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -523,87 +523,4 @@ io_arrayMake(char * __restrict psArgs, int nargs, cons (*app = strsep((char **) &psArgs, csDelim)); **app ? i++ : i, **app ? app++ : app); return i; -} - -/* - * io_MakeAV() Parse and make attribute/value pair - * - * @csArgs = Input argument line - * @csDelim = Delimiter for separate - * @psAttr = Output Attribute - * @attrLen = Size of attribute array - * @psValue = Output Value, if ==NULL this element not present value or not wanted for return - * @valLen = Size of value array - * return: 0 error format; -1 error:: can`t read; >0 ok, number of readed items -*/ -int -io_MakeAV(const char * __restrict csArgs, const char *csDelim, - char * __restrict psAttr, int attrLen, char * __restrict psValue, int valLen) -{ - register int ret = 0; - char *pos, *psBuf; - - if (!csArgs || !csDelim || !psAttr || !attrLen) - return -1; - if (psValue && !valLen) - return -1; - else - memset(psValue, 0, valLen); - psBuf = io_strdup(csArgs); - if (!psBuf) { - LOGERR; - return -1; - } - - pos = strpbrk(psBuf, csDelim); - if (pos) - *pos++ = 0; - ret++; - strlcpy(psAttr, psBuf, attrLen); - - if (pos && *pos) { - ret++; - if (psValue) - strlcpy(psValue, pos, valLen); - } - - io_free(psBuf); - return ret; -} - -/* - * io_MakeAV2() Parse and make attribute/value pair over input string - * - * @csArgs = Input argument line, will be modified! - * @csDelim = Delimiter for separate - * @psAttr = Output Attribute - * @psValue = Output Value, if ==NULL this element not present value or not wanted for return - * return: 0 error format; -1 error:: can`t read; >0 ok, number of readed items -*/ -int -io_MakeAV2(char * __restrict psArgs, const char *csDelim, - char * __restrict psAttr, char * __restrict psValue) -{ - register int ret = 0; - char *pos; - - if (!psArgs || !csDelim) - return -1; - - pos = strpbrk(psArgs, csDelim); - if (pos) - *pos++ = 0; - ret++; - if (psAttr) - psAttr = psArgs; - - if (psValue) { - if (pos && *pos) { - ret++; - psValue = pos; - } else - psValue = NULL; - } - - return ret; }