+static void destroywin(GtkWidget* w, Client *c);
+static void die(char *str);
+static void download(WebKitDownload *o, GParamSpec *pspec, Client *c);
+static void drawindicator(Client *c);
+static gboolean exposeindicator(GtkWidget *w, GdkEventExpose *e, Client *c);
+static gboolean initdownload(WebKitWebView *view, WebKitDownload *o, Client *c);
+static gchar *geturi(Client *c);
+static void hidesearch(Client *c, const Arg *arg);
+static void hideurl(Client *c, const Arg *arg);
+static gboolean keypress(GtkWidget* w, GdkEventKey *ev, Client *c);
+static void linkhover(WebKitWebView* page, const gchar* t, const gchar* l, Client *c);
+static void loadcommit(WebKitWebView *view, WebKitWebFrame *f, Client *c);
+static void loadstart(WebKitWebView *view, WebKitWebFrame *f, Client *c);
+static void loadfile(Client *c, const gchar *f);
+static void loaduri(Client *c, const Arg *arg);
+static void navigate(Client *c, const Arg *arg);
+static Client *newclient(void);
+static WebKitWebView *newwindow(WebKitWebView *v, WebKitWebFrame *f, Client *c);
+static void pasteurl(GtkClipboard *clipboard, const gchar *text, gpointer d);
+static GdkFilterReturn processx(GdkXEvent *xevent, GdkEvent *event, gpointer d);
+static void print(Client *c, const Arg *arg);
+static void proccookies(SoupMessage *m, Client *c);
+static void progresschange(WebKitWebView *view, gint p, Client *c);
+static void request(SoupSession *s, SoupMessage *m, Client *c);
+static void reload(Client *c, const Arg *arg);
+static void rereadcookies(void);
+static void setcookie(char *name, char *val, char *dom, char *path, long exp);
+static void setup(void);
+static void titlechange(WebKitWebView* view, WebKitWebFrame* frame, const gchar* title, Client *c);
+static void scroll(Client *c, const Arg *arg);
+static void searchtext(Client *c, const Arg *arg);
+static void source(Client *c, const Arg *arg);
+static void showsearch(Client *c, const Arg *arg);
+static void showurl(Client *c, const Arg *arg);
+static void stop(Client *c, const Arg *arg);
+static void titlechange(WebKitWebView* view, WebKitWebFrame* frame, const gchar* title, Client *c);
+static gboolean unfocusbar(GtkWidget *w, GdkEventFocus *e, Client *c);
+static void usage(void);
+static void update(Client *c);
+static void windowobjectcleared(GtkWidget *w, WebKitWebFrame *frame, JSContextRef js, JSObjectRef win, Client *c);
+static void zoom(Client *c, const Arg *arg);
+
+/* configuration, allows nested code to access above variables */
+#include "config.h"
+
+gchar *
+buildpath(const gchar *path) {
+ gchar *apath, *p;
+ FILE *f;
+
+ /* creating directory */
+ if(path[0] == '/')
+ apath = g_strdup(path);
+ else
+ apath = g_strconcat(g_get_home_dir(), "/", path, NULL);
+ if((p = strrchr(apath, '/'))) {
+ *p = '\0';
+ g_mkdir_with_parents(apath, 0755);
+ *p = '/';
+ }
+ /* creating file (gives error when apath ends with "/") */
+ if((f = g_fopen(apath, "a")))
+ fclose(f);
+ puts(apath);
+ return apath;
+}