diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-01 12:51:52 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-08-01 12:51:52 +0200 |
commit | d6fb42f496c6053598907ce2cbb0b6536a25d201 (patch) | |
tree | f12c2256c4d4cb47aa14205ed4b6fad232b8473a /sys/src | |
parent | 0140f20af42ed6f9a2f383d11a298b0dcad38149 (diff) |
mothra: fix selurl()
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/cmd/mothra/mothra.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c index b2713e3e1..abb5750f0 100644 --- a/sys/src/cmd/mothra/mothra.c +++ b/sys/src/cmd/mothra/mothra.c @@ -942,24 +942,6 @@ urlstr(Url *url){ return url->fullname; return url->reltext; } -Url* selurl(char *urlname){ - static Url url; - - free(url.reltext); - free(url.basename); - seturl(&url, urlname, current ? current->url->fullname : ""); - selection=&url; - message("selected: %s", urlstr(selection)); - plgrabkb(cmd); /* for snarf */ - return selection; -} -void seturl(Url *url, char *urlname, char *base){ - url->reltext = strdup(urlname); - url->basename = strdup(base); - url->fullname[0] = 0; - url->tag[0] = 0; - url->map = 0; -} Url *copyurl(Url *u){ Url *v; v=emalloc(sizeof(Url)); @@ -973,6 +955,24 @@ void freeurl(Url *u){ free(u->basename); free(u); } +void seturl(Url *url, char *urlname, char *base){ + url->reltext = strdup(urlname); + url->basename = strdup(base); + url->fullname[0] = 0; + url->tag[0] = 0; + url->map = 0; +} +Url* selurl(char *urlname){ + Url *last; + + last=selection; + selection=emalloc(sizeof(Url)); + seturl(selection, urlname, current ? current->url->fullname : ""); + if(last) freeurl(last); + message("selected: %s", urlstr(selection)); + plgrabkb(cmd); /* for snarf */ + return selection; +} /* * get the file at the given url |