summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index cc350f6..fb01520 100644
--- a/parser.c
+++ b/parser.c
@@ -527,7 +527,7 @@ static int Parser_get_unit(char *parameter,char *units)
return units_present;
}
-void Parser_main (char *in, int interactive_terminal, void(*cbfunc)(gpointer, gchar *), gpointer user_data)
+void Parser_main (char *raw_in, int interactive_terminal, void(*cbfunc)(gpointer, gchar *), gpointer user_data)
{
int in_pos; /* this identifies the single character of in being processed */
int command_depth; /* how many command words have been parsed */
@@ -556,7 +556,10 @@ void Parser_main (char *in, int interactive_terminal, void(*cbfunc)(gpointer, gc
int channel;
int with_id_code;
- strcpy(in+strlen(in)," "); /* add white space to the end of the input string */
+ g_strstrip (raw_in);
+
+ // add white space to the end of the input string - FIXME?
+ gchar *in = g_strdup_printf ("%s ", raw_in);
in_pos = 0; /* start at the beginning of the input string */
semicolon_found = 0;
@@ -768,8 +771,11 @@ void Parser_main (char *in, int interactive_terminal, void(*cbfunc)(gpointer, gc
if (interactive_terminal) {
(*cbfunc)(user_data, "");
}
+
+ g_free (in);
}
+
static int Parser_channel (int *channel,int with_id_code,int routine_num)
{
/* return if no channel suffixes appeared */