Index: app.c =================================================================== --- app.c (revision 13235) +++ app.c (working copy) @@ -1105,7 +1105,21 @@ return count; } -unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen) +/*! \brief Seperate string into arguments. + \param buf The string to be parsed (this must be a writable copy, as it will be modified) + \param delim Single character to deliminate arguments on (pass in NUL if using a list) + \param delimlist A string of deliminator characters (use NULL if not using a list) + \param array An array of 'char *' to be filled in with pointers to the found arguments + \param arraylen The number of elements in the array (i.e. the number of arguments you will accept) + + Uses either a single char deliminator or a list of delininators. + Keeps parenthes and double quotes within an single argument. + Allows for backslash escaped characters. + + \return The number of arguments found, or zero if the function arguments are not valid. +*/ + +static unsigned int ast_app_separate_args_internal(char *buf, char delim, char *delimlist, char **array, int arraylen) { int argc; char *scan; @@ -1137,6 +1151,9 @@ } else if ((*scan == delim) && !paren && !quote) { *scan++ = '\0'; break; + } else if (delimlist && !paren && !quote && strchr(delimlist, *scan)) { + *scan++ = '\0'; + break; } } } @@ -1147,6 +1164,22 @@ return argc; } + +/*! \brief Separate string into arguments using a single char deliminators. + \note Stub function to ast_seperate_args_internal + */ +unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen) { + return ast_app_separate_args_internal(buf, delim, NULL, array, arraylen); + } + + +/*! \brief Separate string into arguments using a list of deliminators + \note Stub function to ast_seperate_args_internal + */ +unsigned int ast_app_separate_args_ex(char *buf, char *delimlist, char **array, int arraylen) { + return ast_app_separate_args_internal(buf, '\0', delimlist, array, arraylen); + } + enum AST_LOCK_RESULT ast_lock_path(const char *path) { char *s; Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 13235) +++ apps/app_meetme.c (working copy) @@ -1838,20 +1838,18 @@ if (!(parse = ast_strdupa(var->value))) return NULL; - AST_STANDARD_APP_ARGS(args, parse); + AST_EXTSTANDARD_APP_ARGS(args, parse); + if (!strcasecmp(args.confno, confno)) { /* Bingo it's a valid conference */ - if (args.pin) { - if (args.pinadmin) - cnf = build_conf(args.confno, args.pin, args.pinadmin, make, dynamic, refcount); - else - cnf = build_conf(args.confno, args.pin, "", make, dynamic, refcount); - } else { - if (args.pinadmin) - cnf = build_conf(args.confno, "", args.pinadmin, make, dynamic, refcount); - else - cnf = build_conf(args.confno, "", "", make, dynamic, refcount); - } + + if (!args.pin) + args.pin = ""; + + if (!args.pinadmin) + args.pinadmin = ""; + + cnf = build_conf(args.confno, args.pin, args.pinadmin, make, dynamic, refcount); break; } } Index: include/asterisk/app.h =================================================================== --- include/asterisk/app.h (revision 13235) +++ include/asterisk/app.h (working copy) @@ -227,6 +227,18 @@ */ #define AST_STANDARD_APP_ARGS(args, parse) \ args.argc = ast_app_separate_args(parse, '|', args.argv, (sizeof(args) - sizeof(args.argc)) / sizeof(args.argv[0])) + +/*! + \brief Performs the 'extended standard' argument separation process for an application. + \param args An argument structure defined using AST_DECLARE_APP_ARGS + \param parse A modifiable buffer containing the input to be parsed + + This function will separate the input string using the standard argument + separator characters '|' and ',', and then and fill in the provided structure, including + the argc argument counter field. + */ +#define AST_EXTSTANDARD_APP_ARGS(args, parse) \ + args.argc = ast_app_separate_args_ex(parse, "|,", args.argv, (sizeof(args) - sizeof(args.argc)) / sizeof(args.argv[0])) /*! \brief Performs the 'nonstandard' argument separation process for an application. @@ -258,6 +270,22 @@ unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen); /*! + \brief Separate a string into arguments in an array (using a list of deliminators) + \param buf The string to be parsed (this must be a writable copy, as it will be modified) + \param delimlist A string of characters to be used to delimit arguments + \param array An array of 'char *' to be filled in with pointers to the found arguments + \param arraylen The number of elements in the array (i.e. the number of arguments you will accept) + + Note: if there are more arguments in the string than the array will hold, the last element of + the array will contain the remaining arguments, not separated. + + The array will be completely zeroed by this function before it populates any entries. + + \return The number of arguments found, or zero if the function arguments are not valid. +*/ +unsigned int ast_app_separate_args_ex(char *buf, char *delimlist, char **array, int arraylen); + +/*! \brief A structure to hold the description of an application 'option'. Application 'options' are single-character flags that can be supplied