X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=surf.c;h=cac31d6a80e3b9f731443ce3a5459b0f2e60410f;hb=981e52d5a755f7a30fc59595ab84f9df05a84f01;hp=5a7f72b7d4d062e00660d5c0a6697a745e843f13;hpb=3ede1035565e387fb56f98b10e6f4026557af099;p=surf.git diff --git a/surf.c b/surf.c index 5a7f72b..cac31d6 100644 --- a/surf.c +++ b/surf.c @@ -306,7 +306,11 @@ find(Client *c, const Arg *arg) { const char * getcookies(SoupURI *uri) { - return NULL; + const char *c; + SoupCookieJar *j = soup_cookie_jar_text_new(cookiefile, TRUE); + c = soup_cookie_jar_get_cookies(j, uri, TRUE); + g_object_unref(j); + return c; } const char * @@ -609,7 +613,7 @@ newwindow(Client *c, const Arg *arg) { if(!plugin) cmd[i++] = "-p"; if(!loadimage) - cmd[i++] = "-l"; + cmd[i++] = "-i"; if(showxid) cmd[i++] = "-x"; cmd[i++] = "--"; @@ -700,7 +704,15 @@ scroll(Client *c, const Arg *arg) { void setcookie(SoupCookie *c) { - + SoupDate *e; + SoupCookieJar *j = soup_cookie_jar_text_new(cookiefile, FALSE); + c = soup_cookie_copy(c); + if(c->expires == NULL) { + e = soup_date_new_from_time_t(time(NULL) + sessiontime); + soup_cookie_set_expires(c, e); + } + soup_cookie_jar_add_cookie(j, c); + g_object_unref(j); } void @@ -837,7 +849,7 @@ updatewinid(Client *c) { void usage(void) { fputs("surf - simple browser\n", stderr); - die("usage: surf [-e Window] [-x] [-i] [-p] [-s] [uri]\n"); + die("usage: surf [-e xid] [-i] [-p] [-s] [-v] [-x] [uri]\n"); } void @@ -880,9 +892,6 @@ main(int argc, char *argv[]) { break; } switch(argv[i][1]) { - case 'x': - showxid = TRUE; - break; case 'e': if(++i < argc) embed = atoi(argv[i]); @@ -898,8 +907,13 @@ main(int argc, char *argv[]) { case 's': script = 0; break; + case 'x': + showxid = TRUE; + break; case 'v': die("surf-"VERSION", © 2009 surf engineers, see LICENSE for details\n"); + default: + usage(); } } if(i < argc)