Skip to content

Commit

Permalink
Fix parsing escaped variables ($'VAR)
Browse files Browse the repository at this point in the history
Thanks to wltb; Closes #10
  • Loading branch information
jjk-jacky committed Oct 1, 2018
1 parent dc6bf81 commit 8c06da7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,13 +973,15 @@ exec_trigger (const gchar *trigger, GError **error)
}
else if (escape)
{
gint j;

g_string_append_c (str, '\'');
for (i = 0; i < len; ++i)
for (j = 0; j < len; ++j)
{
if (value[i] == '\'')
if (value[j] == '\'')
g_string_append (str, "'\\''");
else
g_string_append_c (str, value[i]);
g_string_append_c (str, value[j]);
}
g_string_append_c (str, '\'');
}
Expand Down

0 comments on commit 8c06da7

Please sign in to comment.