+static void destroywin(GtkWidget* w, Client *c);
+static void die(char *str);
+static void download(Client *c, const Arg *arg);
+static void drawindicator(Client *c);
+static gboolean exposeindicator(GtkWidget *w, GdkEventExpose *e, Client *c);
+static void find(Client *c, const Arg *arg);
+static const char *getatom(Client *c, Atom a);
+static const char *getcookies(SoupURI *uri);
+static char *geturi(Client *c);
+void gotheaders(SoupMessage *msg, gpointer user_data);
+static gboolean initdownload(WebKitWebView *v, WebKitDownload *o, Client *c);
+static void itemclick(GtkMenuItem *mi, Client *c);
+static gboolean keypress(GtkWidget *w, GdkEventKey *ev, Client *c);
+static void linkhover(WebKitWebView *v, const char* t, const char* l, Client *c);
+static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c);
+static void loaduri(Client *c, const Arg *arg);
+static void navigate(Client *c, const Arg *arg);
+static Client *newclient(void);
+static void newwindow(Client *c, const Arg *arg);
+static void newrequest(SoupSession *s, SoupMessage *msg, gpointer v);
+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);
+static void progresschange(WebKitWebView *view, GParamSpec *pspec, Client *c);
+static void reload(Client *c, const Arg *arg);
+static void resize(GtkWidget *w, GtkAllocation *a, Client *c);
+static void scroll(Client *c, const Arg *arg);
+static void setatom(Client *c, Atom a, const char *v);
+static void setcookie(SoupCookie *c);
+static void setup(void);
+static void sigchld(int unused);
+static void source(Client *c, const Arg *arg);
+static void spawn(Client *c, const Arg *arg);
+static void stop(Client *c, const Arg *arg);
+static void titlechange(WebKitWebView *v, WebKitWebFrame* frame, const char* title, Client *c);
+static void update(Client *c);
+static void updatedownload(WebKitDownload *o, GParamSpec *pspec, Client *c);
+static void updatewinid(Client *c);
+static void usage(void);
+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"
+
+char *
+buildpath(const char *path) {
+ char *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);
+ return apath;
+}