--- main_pbx_old.c 2009-12-21 22:32:54.083124988 +0100 +++ utils_extconf_old.c 2009-12-21 22:30:59.023178543 +0100 @@ -1,34 +1,3 @@ -/* - * Special characters used in patterns: - * '_' underscore is the leading character of a pattern. - * In other position it is treated as a regular char. - * . one or more of any character. Only allowed at the end of - * a pattern. - * ! zero or more of anything. Also impacts the result of CANMATCH - * and MATCHMORE. Only allowed at the end of a pattern. - * In the core routine, ! causes a match with a return code of 2. - * In turn, depending on the search mode: (XXX check if it is implemented) - * - E_MATCH retuns 1 (does match) - * - E_MATCHMORE returns 0 (no match) - * - E_CANMATCH returns 1 (does match) - * - * / should not appear as it is considered the separator of the CID info. - * XXX at the moment we may stop on this char. - * - * X Z N match ranges 0-9, 1-9, 2-9 respectively. - * [ denotes the start of a set of character. Everything inside - * is considered literally. We can have ranges a-d and individual - * characters. A '[' and '-' can be considered literally if they - * are just before ']'. - * XXX currently there is no way to specify ']' in a range, nor \ is - * considered specially. - * - * When we compare a pattern with a specific extension, all characters in the extension - * itself are considered literally. - * XXX do we want to consider space as a separator as well ? - * XXX do we want to consider the separators in non-patterns as well ? - */ - /*! * \brief helper functions to sort extensions and patterns in the desired way, * so that more specific patterns appear first. @@ -61,21 +30,22 @@ /* load, sign extend and advance pointer until we find * a valid character. */ - c = *(*p)++; + while ( (c = *(*p)++) && (c == ' ' || c == '-') ) + ; /* ignore some characters */ /* always return unless we have a set of chars */ - switch (toupper(c)) { + switch (c) { default: /* ordinary character */ return 0x0000 | (c & 0xff); case 'N': /* 2..9 */ - return 0x0800 | '2' ; + return 0x0700 | '2' ; case 'X': /* 0..9 */ - return 0x0A00 | '0'; + return 0x0900 | '0'; case 'Z': /* 1..9 */ - return 0x0900 | '1'; + return 0x0800 | '1'; case '.': /* wildcard */ return 0x10000;