sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 0ebe956639e8a61f5c46d31d2858ec7ce9471dd6
parent 67c6db28da84913ec2efa57fd96201de1aeaabf4
Author: Aurélien Aptel <aurelien.aptel@gmail.com>
Date:   Sun, 22 Aug 2010 21:16:44 +0200

merge.
Diffstat:
Msurf.suckless.org/patches/searchengines.md | 2++
Asurf.suckless.org/patches/surf-0.4-searchengines.diff | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/surf.suckless.org/patches/searchengines.md b/surf.suckless.org/patches/searchengines.md @@ -26,9 +26,11 @@ Download * [surf-0.1-searchengines.diff](surf-0.1-searchengines.diff) (1964) (20090923) * [surf-0.3-searchengines.diff](surf-0.3-searchengines.diff) (2107) (20091204) +* [surf-0.4-searchengines.diff](surf-0.4-searchengines.diff) (2107) (20091204) Author ------ * Nils Schweinsberg (McManiaC) <[mail@n-sch.de](mailto:mail@n-sch.de)> * Samuel Baldwin (shardz) <[recursive.forest@gmail.com](mailto:recursive.forest@gmail.com)> +* Alex Puterbaugh (zombine) <[puterbaugh0@gmail.com](mailto:puterbaugh0@gmail.com)> diff --git a/surf.suckless.org/patches/surf-0.4-searchengines.diff b/surf.suckless.org/patches/surf-0.4-searchengines.diff @@ -0,0 +1,53 @@ +diff -r dbb565b8d61c surf.c +--- a/surf.c Fri Jun 25 09:42:58 2010 +0200 ++++ b/surf.c Fri Aug 13 16:28:31 2010 -0400 +@@ -55,6 +55,11 @@ + const Arg arg; + } Key; + ++typedef struct { ++ char *token; ++ char *uri; ++} SearchEngine; ++ + static Display *dpy; + static Atom atoms[AtomLast]; + static Client *clients = NULL; +@@ -90,6 +95,7 @@ + static Client *newclient(void); + static void newwindow(Client *c, const Arg *arg); + static void newrequest(SoupSession *s, SoupMessage *msg, gpointer v); ++static gchar *parseuri(const gchar *uri); + static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d); + static void print(Client *c, const Arg *arg); + static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event, gpointer d); +@@ -388,8 +394,7 @@ + + if(strcmp(uri, "") == 0) + return; +- u = g_strrstr(uri, "://") ? g_strdup(uri) +- : g_strdup_printf("http://%s", uri); ++ u = parseuri(uri); + /* prevents endless loop */ + if(c->uri && strcmp(u, c->uri) == 0) { + reload(c, &a); +@@ -562,6 +567,19 @@ + spawn(NULL, &a); + } + ++ ++gchar * ++parseuri(const gchar *uri) { ++ guint i; ++ for (i = 0; i < LENGTH(searchengines); i++) { ++ if (searchengines[i].token == NULL || searchengines[i].uri == NULL || *(uri + strlen(searchengines[i].token)) != ' ') ++ continue; ++ if (g_str_has_prefix(uri, searchengines[i].token)) ++ return g_strdup_printf(searchengines[i].uri, uri + strlen(searchengines[i].token) + 1); ++ } ++ return g_strrstr(uri, "://") ? g_strdup(uri) : g_strdup_printf("http://%s", uri); ++} ++ + void + pasteuri(GtkClipboard *clipboard, const char *text, gpointer d) { + Arg arg = {.v = text };