From e8dcc5d429a2111eea4f16ce880745bbfc8e6a00 Mon Sep 17 00:00:00 2001 From: Luigi Rizzo <rizzo@icir.org> Date: Wed, 10 May 2006 07:45:14 +0000 Subject: [PATCH] document special character interpretation. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@26283 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- pbx.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/pbx.c b/pbx.c index 9080e4d816..24aa3febde 100644 --- a/pbx.c +++ b/pbx.c @@ -560,6 +560,33 @@ static void pbx_destroy(struct ast_pbx *p) free(p); } +/* + * Special characters used in patterns: + * '_' underscore is the leading character of a pattern. + * In other position it is treated as a regular char. + * ' ' '-' space and '-' are separator and ignored. + * . 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. + * / 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 with the only exception of '-' which is considered + * as a separator and thus ignored. + * 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. @@ -722,6 +749,10 @@ static int _extension_match_core(const char *pattern, const char *data, enum ext return 0; } pattern++; /* skip leading _ */ + /* + * XXX below we stop at '/' which is a separator for the CID info. However we should + * not store '/' in the pattern at all. When we insure it, we can remove the checks. + */ while (*data && *pattern && *pattern != '/') { const char *end; -- GitLab