Loading

Paste #p1db6gbm2

  1. char *escape (const char *s)
  2. {
  3.   GString *string = g_string_new (NULL);
  4.   const char *next;
  5.   while (next = strpbrk (s, CHARS))
  6.     {
  7.       g_string_append_len (string, s, next - s);
  8.       g_string_append_c (string, '\');
  9.       s = next;
  10.     }
  11.   g_string_append (string, s);
  12.   return g_string_free (string, FALSE);
  13. }