summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/main.c b/main.c
index aba1b70..98bd3a0 100644
--- a/main.c
+++ b/main.c
@@ -322,6 +322,10 @@ Lend:
void
fsstat(Req *r)
{
+ GuiElement *g = r->fid->aux;
+ PropVal p;
+ char *buf;
+
r->d.qid = r->fid->qid;
r->d.uid = estrdup9p(username);
r->d.gid = estrdup9p(username);
@@ -335,6 +339,12 @@ fsstat(Req *r)
r->d.name = estrdup9p("/");
r->d.mode = 0555|DMDIR;
break;
+ case Qprop:
+ p = getprop(g, QID_PROP(r->fid->qid), 1);
+ buf = propspecs[QID_PROP(r->fid->qid)].print(p);
+ r->d.length = strlen(buf);
+ free(buf);
+ break;
}
respond(r, nil);
@@ -417,9 +427,14 @@ proptreegen(int n, Dir *d, void *aux)
if(!done){
PropSpec spec = propspecs[g->props[n].tag];
+ PropVal p = getprop(g, g->props[n].tag, 0);
+ char *buf = spec.print(p);
+
d->mode = 0666;
d->name = estrdup9p(spec.name);
d->qid = g->props[n].qid;
+ d->length = strlen(buf);
+ free(buf);
}
runlock(&g->lock);
@@ -459,6 +474,7 @@ Lgotevent: currentsize = g->currentevents ? strlen(g->currentevents) : 0;
eventsize = strlen(event);
wlock(&g->lock);
+ g->qevent.vers++;
g->currentevents = erealloc(g->currentevents, currentsize+eventsize+1);
memcpy(g->currentevents+currentsize, event, eventsize);
g->currentevents[currentsize+eventsize] = 0;
@@ -544,12 +560,12 @@ fswrite(Req *r)
{
int tag = QID_PROP(r->fid->qid);
PropSpec spec = propspecs[tag];
- PropVal val;
+ PropVal val = getprop(g, tag, 1);
char *buf = emalloc(r->ifcall.count + 1);
buf[r->ifcall.count] = 0;
memcpy(buf, r->ifcall.data, r->ifcall.count);
- err = spec.parse(buf, &val);
+ err = spec.parse(buf, r->ifcall.offset, &val);
if(err == nil)
setprop(g, tag, val, 1);
free(buf);