aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-25 20:38:40 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-25 20:38:40 +0000
commitf0020259697ccc2e20f8c37819c67f4b9019e630 (patch)
tree7963c62292e0d25697e8f7aaa352502f833bf2aa
parentd82adf08c7958dede2e688e65a62b510d5b8d991 (diff)
Merged revisions 242904 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r242904 | oej | 2010-01-25 21:27:59 +0100 (Mån, 25 Jan 2010) | 10 lines Merged revisions 242850 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r242850 | oej | 2010-01-25 21:03:38 +0100 (Mån, 25 Jan 2010) | 2 lines Report error when writing to functions returns error in AMI setvar action ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@242915 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/ast_expr2f.c101
-rw-r--r--main/manager.c19
2 files changed, 39 insertions, 81 deletions
diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c
index 12615ba5e..ec0cb99ea 100644
--- a/main/ast_expr2f.c
+++ b/main/ast_expr2f.c
@@ -11,7 +11,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 33
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -33,7 +33,7 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
@@ -56,6 +56,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -86,8 +87,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
-#endif /* ! C99 */
-
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -97,12 +96,11 @@ typedef unsigned int flex_uint32_t;
#else /* ! __cplusplus */
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
+#if __STDC__
#define YY_USE_CONST
-#endif /* defined (__STDC__) */
+#endif /* __STDC__ */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
@@ -138,6 +136,8 @@ typedef void* yyscan_t;
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
#define yy_flex_debug yyg->yy_flex_debug_r
+int ast_yylex_init (yyscan_t* scanner);
+
/* Enter a start condition. This macro really ought to take a parameter,
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
@@ -195,9 +195,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
+typedef unsigned int yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -595,7 +600,7 @@ int ast_yyget_column(yyscan_t yyscanner);
static int curlycount = 0;
static char *expr2_token_subst(const char *mess);
-#line 597 "ast_expr2f.c"
+#line 602 "ast_expr2f.c"
#define INITIAL 0
#define var 1
@@ -659,10 +664,6 @@ static int yy_init_globals (yyscan_t yyscanner );
# define yylloc yyg->yylloc_r
-int ast_yylex_init (yyscan_t* scanner);
-
-int ast_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
@@ -742,7 +743,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -807,11 +808,9 @@ static int input (yyscan_t yyscanner );
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
-extern int ast_yylex \
- (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
+extern int ast_yylex (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
-#define YY_DECL int ast_yylex \
- (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
+#define YY_DECL int ast_yylex (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
#endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after yytext and yyleng
@@ -841,7 +840,7 @@ YY_DECL
#line 125 "ast_expr2.fl"
-#line 843 "ast_expr2f.c"
+#line 842 "ast_expr2f.c"
yylval = yylval_param;
@@ -1182,7 +1181,7 @@ YY_RULE_SETUP
#line 232 "ast_expr2.fl"
ECHO;
YY_BREAK
-#line 1184 "ast_expr2f.c"
+#line 1183 "ast_expr2f.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(var):
yyterminate();
@@ -1416,7 +1415,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, (size_t) num_to_read );
+ yyg->yy_n_chars, num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
}
@@ -1440,14 +1439,6 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ast_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
-
yyg->yy_n_chars += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
@@ -1876,9 +1867,7 @@ static void ast_yyensure_buffer_stack (yyscan_t yyscanner)
yyg->yy_buffer_stack = (struct yy_buffer_state**)ast_yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
-
+
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
yyg->yy_buffer_stack_max = num_to_alloc;
@@ -1896,8 +1885,6 @@ static void ast_yyensure_buffer_stack (yyscan_t yyscanner)
(yyg->yy_buffer_stack,
num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in ast_yyensure_buffer_stack()" );
/* zero only the new slots.*/
memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -1942,7 +1929,7 @@ YY_BUFFER_STATE ast_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yys
/** Setup the input buffer state to scan a string. The next call to ast_yylex() will
* scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
+ * @param str a NUL-terminated string to scan
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
@@ -2216,42 +2203,6 @@ int ast_yylex_init(yyscan_t* ptr_yy_globals)
return yy_init_globals ( *ptr_yy_globals );
}
-/* ast_yylex_init_extra has the same functionality as ast_yylex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to ast_yyalloc in
- * the yyextra field.
- */
-
-int ast_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
-{
- struct yyguts_t dummy_yyguts;
-
- ast_yyset_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- ast_yyset_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
static int yy_init_globals (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
@@ -2373,10 +2324,10 @@ int ast_yyerror(const char *, YYLTYPE *, struct parse_io *); /* likewise */
void ast_yyfree(void *ptr, yyscan_t yyscanner)
{
- /* the normal generated ast_yyfree func just frees its first arg;
- this get complaints on some systems, as sometimes this
- arg is a nil ptr! It's usually not fatal, but is irritating! */
- free( (char *) ptr );
+ /* the normal generated ast_yyfree func just frees its first arg;
+ this get complaints on some systems, as sometimes this
+ arg is a nil ptr! It's usually not fatal, but is irritating! */
+ free( (char *) ptr );
}
int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
diff --git a/main/manager.c b/main/manager.c
index dfd8b7b4e..dea59e975 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1698,7 +1698,8 @@ static int action_setvar(struct mansession *s, const struct message *m)
const char *name = astman_get_header(m, "Channel");
const char *varname = astman_get_header(m, "Variable");
const char *varval = astman_get_header(m, "Value");
-
+ int res = 0;
+
if (ast_strlen_zero(varname)) {
astman_send_error(s, m, "No variable specified");
return 0;
@@ -1711,14 +1712,20 @@ static int action_setvar(struct mansession *s, const struct message *m)
return 0;
}
}
-
- pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
+ if (varname[strlen(varname)-1] == ')') {
+ char *function = ast_strdupa(varname);
+ res = ast_func_write(c, function, varval);
+ } else {
+ pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
+ }
if (c)
ast_channel_unlock(c);
-
- astman_send_ack(s, m, "Variable Set");
-
+ if (res == 0) {
+ astman_send_ack(s, m, "Variable Set");
+ } else {
+ astman_send_error(s, m, "Variable not set");
+ }
return 0;
}