commit f6dee3c0a0796b473224d88d8beae63f85f35722
parent 9ada8edddce7b016f663e10a2772cb89108eaf70
Author: Kris Maglione <bsdaemon@wmii.de>
Date: Fri, 23 Jun 2006 17:38:29 -0400
Added size information to certain files so inferno can append them
Diffstat:
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c
@@ -253,7 +253,12 @@ message_root(char *message)
if(!strncmp(message, "quit", 5)) {
srv.running = 0;
return nil;
- }if(!strncmp(message, "view ", 5)) {
+ }
+ if(!strchr(message, ' ')) {
+ message = realloc(message, strlen(message) + 2);
+ strcat(message, " ");
+ }
+ if(!strncmp(message, "view ", 5)) {
select_view(&message[5]);
return nil;
}if(!strncmp(message, "selcolors ", 10)) {
@@ -574,13 +579,30 @@ fs_walk(P9Req *r) {
respond(r, nil);
}
+unsigned int
+fs_size(FileId *f) {
+ switch(f->tab.type) {
+ default:
+ return 0;
+ case FsFColRules:
+ case FsFTagRules:
+ return f->rule->size;
+ case FsFKeys:
+ return def.keyssz;
+ case FsFCtags:
+ return strlen(f->client->tags);
+ case FsFprops:
+ return strlen(f->client->props);
+ }
+}
+
void
fs_stat(P9Req *r) {
Stat s;
int size;
unsigned char *buf;
- dostat(&s, 0, r->fid->aux);
+ dostat(&s, fs_size(r->fid->aux), r->fid->aux);
r->ofcall.nstat = size = ixp_sizeof_stat(&s);
buf = cext_emallocz(size);
r->ofcall.stat = buf;
@@ -609,7 +631,7 @@ fs_read(P9Req *r) {
tf = f = lookup_file(f, nil);
/* Note: f->tab.name == "."; goto next */
for(f=f->next; f; f=f->next) {
- dostat(&s, 0, f);
+ dostat(&s, fs_size(f), f);
n = ixp_sizeof_stat(&s);
if(offset >= r->ifcall.offset) {
if(size < n)
diff --git a/cmd/wmiimenu.c b/cmd/wmiimenu.c
@@ -311,7 +311,7 @@ static char *
read_allitems()
{
static char *maxname = nil;
- char *p, buf[1024];
+ char *p, buf[1024];
unsigned int len = 0, max = 0;
while(fgets(buf, sizeof(buf), stdin)) {