]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cond api return -ERR on all syntax errors
authorAron Podrigal <aronp@guaranteedplus.com>
Thu, 25 Dec 2014 15:34:37 +0000 (10:34 -0500)
committerAron Podrigal <aronp@guaranteedplus.com>
Thu, 25 Dec 2014 15:34:37 +0000 (10:34 -0500)
src/mod/applications/mod_commands/mod_commands.c

index b485a71a780c26d1cf334fd78800dbd1202ebd79..51f8f727144a5ec430ef3fd2db2428f710bd181e 100644 (file)
@@ -1922,21 +1922,18 @@ SWITCH_STANDARD_API(cond_function)
                        }
                }
                if (!*expr) {
-                       stream->write_function(stream, "-ERR while looking for closing quote near < %s > \n", a);
-                       goto end;
+                       goto error;
                }
                *expr++ = '\0';
 
                if (!switch_isspace(*expr)) {
-                       stream->write_function(stream, "-ERR, Syntax error near  < %s > \n", expr);
-                       goto end;
+                       goto error;
                }
        } else {
                if ((expr = strchr(a, ' '))) {
                        *expr++ = '\0';
                } else {
-                       stream->write_function(stream, "-ERR, Syntax error near < %s > \n", a);
-                       goto end;
+                       goto error;
                }
        }
 
@@ -1950,7 +1947,7 @@ SWITCH_STANDARD_API(cond_function)
                        case '=':
                                goto operator;
                        default:
-                               expr++;
+                               goto error;
                                break;
                }
        }
@@ -1995,8 +1992,7 @@ operator:
                        break;
 
                default:
-                       stream->write_function(stream, "-ERR, Syntax error near  %s  invalid conditional operator.\n", expr);
-                       goto end;
+                       goto error;
        }
 
        if (o) {
@@ -2019,37 +2015,32 @@ operator:
                                }
                        }
                        if (!*expr) {
-                               stream->write_function(stream, "-ERR while looking for closing quote near < %s >!\n", b);
-                               goto end;
+                               goto error;
                        }
                        *expr++ = '\0';
 
                        if (!switch_isspace(*expr)) {
-                               stream->write_function(stream, "-ERR, Syntax error near  < %s > \n", expr);
-                               goto end;
+                               goto error;
                        }
                } else {
                        if ((expr = strchr(b, ' '))) {
                                *expr++ = '\0';
                        } else {
-                               stream->write_function(stream, "-ERR, Syntax error near < %s > \n", b);
-                               goto end;
+                               goto error;
                        }
                }
 
                while (switch_isspace(*expr)) expr++;
 
                if (*expr != '?') {
-                       stream->write_function(stream, "-ERR, Syntax error near < %s > no expression found.\n", expr);
-                       goto end;
+                       goto error;
                }
 
                *expr = ':';
 
                argc = switch_separate_string(expr, ':', argv, (sizeof(argv) / sizeof(argv[0])));
                if (!(argc >= 2 && argc <= 3)) {
-                       stream->write_function(stream, "-ERR, Syntax error near < %s > , Invalid expression.\n", ++expr);
-                       goto end;
+                       goto error;
                }
 
                s_a = a;