}
g_free (parts);
if (search_uri)
- search = g_strdup_printf (search_uri, parts[1]);
+ {
+ if (strstr (search_uri, "%s"))
+ search = g_strdup_printf (search_uri, parts[1]);
+ else
+ search = g_strdup_printf ("%s%s", search_uri, parts[1]);
+ }
return search;
}
return g_strdup (uri);
"uri", "http://www.searchmash.com/search/%s",
"token", "sm", NULL);
katze_array_add_item (search_engines, item);
+ g_object_unref (item);
+ item = g_object_new (KATZE_TYPE_ITEM,
+ "uri", "http://www.searchmash.com/search/",
+ "token", "se", NULL);
+ katze_array_add_item (search_engines, item);
+ g_object_unref (item);
#define test_input(input, expected) \
uri = sokoke_magic_uri (input, search_engines); \
test_input ("192.168.1.1:8000", "http://192.168.1.1:8000");
test_input ("sm midori", SM "midori");
test_input ("sm cats dogs", SM "cats dogs");
+ test_input ("se cats dogs", SM "cats dogs");
test_input ("dict midori", NULL);
test_input ("cats", NULL);
test_input ("cats dogs", NULL);