diff options
author | Yorhel <git@yorhel.nl> | 2009-04-26 13:10:00 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-04-26 13:10:00 +0200 |
commit | ece21a668d43dac69c25315a22f1f7d0147f7198 (patch) | |
tree | 004934bc1fbefe7764451733ea44e6eabff55761 | |
parent | 9cc79b0fab0b4301801387abb57fc52b03f88228 (diff) |
Fixed display of the root directory
-rw-r--r-- | src/calc.c | 10 | ||||
-rw-r--r-- | src/util.c | 3 |
2 files changed, 10 insertions, 3 deletions
@@ -344,9 +344,13 @@ void calc_process() { strcpy(t->name, orig->name); } else { t->name = malloc(strlen(path)+strlen(name)+1); - strcpy(t->name, path); - strcat(t->name, "/"); - strcat(t->name, name); + if(strcmp(path, "/")) + strcpy(t->name, path); + if(strcmp(name, ".")) { + strcat(t->name, "/"); + strcat(t->name, name); + } else + t->name[0] = 0; } root = t; curdev = fs.st_dev; @@ -214,6 +214,9 @@ char *getpath(struct dir *cur) { struct dir *d, **list; int c, i; + if(!cur->name[0]) + return "/"; + c = i = 1; for(d=cur; d!=NULL; d=d->parent) { i += strlen(d->name)+1; |