--- libaitio/src/Attic/tools.c 2012/07/30 11:49:46 1.16.4.1 +++ libaitio/src/Attic/tools.c 2012/07/30 11:51:17 1.16.4.2 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: tools.c,v 1.16.4.1 2012/07/30 11:49:46 misho Exp $ +* $Id: tools.c,v 1.16.4.2 2012/07/30 11:51:17 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -300,6 +300,28 @@ io_FreeNullTerm(char *** __restrict arr) io_free(*arr); *arr = NULL; } +} + +/* + * io_argsNum() Parse and calculate number of arguments + * + * @csArgs = Input arguments line + * @csDelim = Delimiter(s) for separate + * return: 0 error format; -1 error:: can`t read; >0 ok, number of items + */ +inline int +io_argsNum(const char *csArgs, const char *csDelim) +{ + register int res; + char *pos; + + assert(csArgs); + assert(csDelim); + if (!csArgs || !csDelim) + return -1; + + for (res = 1, pos = (char*) csArgs; (pos = strpbrk(pos, csDelim)); res++, pos++); + return res; } /*