From 5e8c4720b8406764b5911d74898c63649d5d5802 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Dec 1999 21:11:22 -0500 Subject: tested and fixed route:close function --- parser.c | 54 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 19 deletions(-) (limited to 'parser.c') diff --git a/parser.c b/parser.c index 6ad0892..2f8a52c 100644 --- a/parser.c +++ b/parser.c @@ -3163,6 +3163,7 @@ static int Go_routeclose_78(gchar** response, int channel, char *parameter,char } else { Set_Route(channel,ROUTE_PRIMARY,temp1); Set_Route(channel,ROUTE_SECONDARY,temp2); + return OK; } break; @@ -3196,11 +3197,7 @@ static int Parse_chan_list(int channel,char *parameter,int *primary_selected, in int *value_pointer; #define PARSE_MAX_STRING 20 - char temp[PARSE_MAX_STRING+1]; // FIXME - if (*response) { - *response[0]=0; - } if ( !(parameter[0]=='(' && parameter[1]=='@')) { return SyntaxError; @@ -3214,53 +3211,72 @@ static int Parse_chan_list(int channel,char *parameter,int *primary_selected, in return Route_Range_Error; } + pointer=1; do { + int error_num = OK; + pointer++; has_module_name = FALSE; /* get module name, if any */ + + GString *name = g_string_new (""); + for (i=0; isalpha(parameter[pointer]) && (i0) { has_module_name = TRUE; - if (!strcmp (temp, "anod")) { + if (!strcmp (name->str, "anod")) { value_pointer = primary_selected; - } else if (!strcmp (temp, "cath")) { + } else if (!strcmp (name->str, "cath")) { if (globals.Flash.routing_required[channel]<2) { - return IllegalParameter; + error_num = IllegalParameter; } value_pointer = secondary_selected; } else { - return IllegalParameter; + error_num = IllegalParameter; } - if (parameter[pointer] == '(' ) { + if (!error_num && (parameter[pointer] == '(' )) { pointer++; } else { - return SyntaxError; + error_num =SyntaxError; } + } + g_string_free (name, TRUE); + + if (error_num) { + return error_num; + } + + GString *digits = g_string_new (""); + /* get digits */ for (i=0; isdigit(parameter[pointer]) && (istr); + g_string_free (digits, TRUE); + + if (error_num) { + return error_num; } - n = atoi(temp); if ((n < 1) || (n > globals.Flash.routing_max_pins[channel])) { return OutOfRange; } @@ -3274,11 +3290,11 @@ static int Parse_chan_list(int channel,char *parameter,int *primary_selected, in } /* query or command? */ - if (*response) { + if (response) { if (*value_pointer == n) { - strcat(*response,"1 "); + *response = g_strdup ("1 "); } else { - strcat(*response,"0 "); + *response = g_strdup ("0 "); } } else { if (value_pointer) { -- cgit