mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 23:08:32 +00:00
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: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@242916 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -94,13 +94,13 @@
|
||||
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE
|
||||
#line 345 "/home/murf/asterisk/1.6.1/main/ast_expr2.y"
|
||||
#line 345 "ast_expr2.y"
|
||||
{
|
||||
struct val *val;
|
||||
struct expr_node *arglist;
|
||||
}
|
||||
/* Line 1489 of yacc.c. */
|
||||
#line 104 "/home/murf/asterisk/1.6.1/main/ast_expr2.h"
|
||||
#line 104 "ast_expr2.h"
|
||||
YYSTYPE;
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
@@ -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
|
||||
@@ -596,7 +601,7 @@ int ast_yyget_column(yyscan_t yyscanner);
|
||||
static int curlycount = 0;
|
||||
static char *expr2_token_subst(const char *mess);
|
||||
|
||||
#line 598 "ast_expr2f.c"
|
||||
#line 603 "ast_expr2f.c"
|
||||
|
||||
#define INITIAL 0
|
||||
#define var 1
|
||||
@@ -660,10 +665,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. */
|
||||
|
||||
@@ -743,7 +744,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,
|
||||
@@ -808,11 +809,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
|
||||
@@ -842,7 +841,7 @@ YY_DECL
|
||||
#line 125 "ast_expr2.fl"
|
||||
|
||||
|
||||
#line 844 "ast_expr2f.c"
|
||||
#line 843 "ast_expr2f.c"
|
||||
|
||||
yylval = yylval_param;
|
||||
|
||||
@@ -1188,7 +1187,7 @@ YY_RULE_SETUP
|
||||
#line 233 "ast_expr2.fl"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1190 "ast_expr2f.c"
|
||||
#line 1189 "ast_expr2f.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(var):
|
||||
yyterminate();
|
||||
@@ -1422,7 +1421,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;
|
||||
}
|
||||
@@ -1446,14 +1445,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;
|
||||
@@ -1882,8 +1873,6 @@ 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*));
|
||||
|
||||
@@ -1902,8 +1891,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*));
|
||||
@@ -1948,7 +1935,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
|
||||
@@ -2222,42 +2209,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;
|
||||
|
||||
@@ -1788,6 +1788,7 @@ 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");
|
||||
@@ -1801,14 +1802,20 @@ static int action_setvar(struct mansession *s, const struct message *m)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (res == 0) {
|
||||
astman_send_ack(s, m, "Variable Set");
|
||||
|
||||
} else {
|
||||
astman_send_error(s, m, "Variable not set");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user