From 145d0b3982f80b4630feb5229216e4fe81de2ddb Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 17 Sep 2011 05:21:49 +0200 Subject: [PATCH] mothra: fix file urls with #fragment --- sys/src/cmd/mothra/mothra.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c index ef51ee2d0..18712238b 100644 --- a/sys/src/cmd/mothra/mothra.c +++ b/sys/src/cmd/mothra/mothra.c @@ -729,9 +729,14 @@ int fileurlopen(Url *url){ *x = 0; snprint(url->fullname, sizeof(url->fullname), "%s/%s", base, rel); if(x) *x = '/'; - fd = open(cleanname(url->fullname), OREAD); }else - fd = open(rel, OREAD); + snprint(url->fullname, sizeof(url->fullname), "%s", rel); + url->tag[0] = 0; + if(x = strrchr(url->fullname, '#')){ + *x++ = 0; + strncpy(url->tag, x, sizeof(url->tag)); + } + fd = open(cleanname(url->fullname), OREAD); if(fd < 0) return -1; memset(url->fullname, 0, sizeof(url->fullname));