[hackers] [surf] removing loadfile. readding later in a simpler way. || Enno Boland (tox)

From: <hg_AT_suckless.org>
Date: Tue, 13 Oct 2009 21:20:06 +0000 (UTC)

changeset: 117:bd3646a3fbfe
tag: tip
user: Enno Boland (tox) <tox_AT_s01.de>
date: Tue Oct 13 23:22:25 2009 +0200
files: surf.c
description:
removing loadfile. readding later in a simpler way.

diff -r 2a6dec9c0c3c -r bd3646a3fbfe surf.c
--- a/surf.c Tue Oct 13 22:02:06 2009 +0200
+++ b/surf.c Tue Oct 13 23:22:25 2009 +0200
@@ -86,7 +86,6 @@
 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);
@@ -339,39 +338,6 @@
 }
 
 void
-loadfile(Client *c, const gchar *f) {
- GIOChannel *chan = NULL;
- GError *e = NULL;
- GString *code;
- gchar *line, *uri;
- Arg arg;
-
- if(strcmp(f, "-") == 0) {
- chan = g_io_channel_unix_new(STDIN_FILENO);
- if (chan) {
- code = g_string_new("");
- while(g_io_channel_read_line(chan, &line, NULL, NULL,
- &e) == G_IO_STATUS_NORMAL) {
- g_string_append(code, line);
- g_free(line);
- }
- webkit_web_view_load_html_string(c->view, code->str,
- "file://.");
- g_io_channel_shutdown(chan, FALSE, NULL);
- g_string_free(code, TRUE);
- }
- arg.v = uri = g_strdup("stdin");
- }
- else {
- arg.v = uri = g_strdup_printf("file://%s", f);
- loaduri(c, &arg);
- }
- c->title = copystr(&c->title, uri);
- update(c);
- g_free(uri);
-}
-
-void
 loaduri(Client *c, const Arg *arg) {
         gchar *u;
         const gchar *uri = (gchar *)arg->v;
@@ -725,7 +691,6 @@
 int main(int argc, char *argv[]) {
         int i;
         Arg arg;
- Client *c;
 
         /* command line args */
         for(i = 1, arg.v = NULL; i < argc; i++) {
@@ -747,12 +712,9 @@
                         arg.v = argv[i];
         }
         setup();
- c = newclient();
+ newclient();
         if(arg.v) {
- if(strchr("./", ((char *)arg.v)[0]) || strcmp("-", (char *)arg.v) == 0)
- loadfile(c, (char *)arg.v);
- else
- loaduri(c, &arg);
+ loaduri(clients, &arg);
         }
         gtk_main();
         cleanup();
Received on Tue Oct 13 2009 - 21:20:06 UTC

This archive was generated by hypermail 2.2.0 : Tue Oct 13 2009 - 21:24:10 UTC