First pass at properly handling account codes in forwarding
[asterisk/asterisk.git] / ast_expr.y
index 4f4bc23..97b2b02 100755 (executable)
 #include <asterisk/ast_expr.h>
 #include <asterisk/logger.h>
 
+#ifdef LONG_LONG_MIN
+#define QUAD_MIN LONG_LONG_MIN
+#endif
+#ifdef LONG_LONG_MAX
+#define QUAD_MAX LONG_LONG_MAX
+#endif
+
 #  if ! defined(QUAD_MIN)
 #   define QUAD_MIN     (-0x7fffffffffffffffL-1)
 #  endif
@@ -341,9 +348,18 @@ ast_yylex (YYSTYPE *lvalp, YYLTYPE *yylloc, struct parser_control *karoto)
        }
        else if( *t1 == 0 )
        {
-               /* we are done. That was quick */
-               p = karoto->ptrptr;
-               yylloc->last_column = t1 - karoto->argv;
+               if( t1 != karoto->ptrptr )
+               {
+                       /* this is the last token */
+                       p = karoto->ptrptr;
+                       karoto->ptrptr = t1;
+               }
+               else
+               {
+                       /* we are done. That was quick */
+                       p = karoto->ptrptr;
+                       yylloc->last_column = t1 - karoto->argv;
+               }
        }
        if( *p == 0 )
                p = 0;
@@ -817,7 +833,7 @@ struct val *a, *b;
        to_string(b);
 
        /* compile regular expression */
-       if ((eval = regcomp (&rp, b->u.s, 0)) != 0) {
+       if ((eval = regcomp (&rp, b->u.s, REG_EXTENDED)) != 0) {
                regerror (eval, &rp, errbuf, sizeof(errbuf));
                ast_log(LOG_WARNING,"regcomp() error : %s",errbuf);
                free_value(a);