diff --git a/BUGS b/BUGS index 07ccc0973dfe735ba51ee69e5128c9fc45ec9399..331d1d204535f779dbd34d5dbbbfe2a5ecea29db 100644 --- a/BUGS +++ b/BUGS @@ -22,6 +22,3 @@ ide.c: synchronous disk write -> polling disk write. search for fs.c: split all name operations off in name.c? (starting with namei but move wdir keep in fs.c) - -ls.c: apply tim's patch - diff --git a/ls.c b/ls.c index dfb9f314aed79f3d4fe9f6c017adbe17f0384e4d..3a29a751fbe15bb8ef86c981bb4e87aa9d45e0ed 100644 --- a/ls.c +++ b/ls.c @@ -25,6 +25,7 @@ main(int argc, char *argv[]) int fd; uint off; uint sz; + char *p; if(argc > 2){ puts("Usage: ls [dir]\n"); @@ -63,8 +64,15 @@ main(int argc, char *argv[]) break; } if(dirent.inum != 0) { - // xxx prepend to name the pathname supplied to ls (e.g. .. in ls ..) - if(stat (dirent.name, &st) < 0) { + p = buf; + if(argc == 2) { + strcpy(p, argv[1]); + p += strlen(p); + if(*(p-1) != '/') + *p++ = '/'; + } + strcpy(p, dirent.name); + if(stat(buf, &st) < 0) { printf(1, "stat: failed %s\n", dirent.name); continue; }