72,10 → 72,28 |
|
void ls_print(const char *f) |
{ |
if (ls_scope(f) == LS_FILE) |
unsigned int scope; |
|
scope = ls_scope(f); |
|
/* If this function is called in a readdir loop, LS_BOGUS |
* can be treated as LS_FILE, since we aren't presenting |
* the full path to open(), just pointer->d_name as obtained |
* from opendir(). This will not happen if ../path/to/file |
* is passed, as may be the argument to ls */ |
|
switch (scope) { |
case LS_DIR: |
printf("%-40s <DIR>\n", f); |
break; |
case LS_FILE: |
printf("%-40s\n", f); |
else |
printf("%-40s <DIR>\n", f); |
break; |
/* This is never reached unless in a readdir() loop */ |
case LS_BOGUS: |
printf("%-40s\n", f); |
break; |
} |
return; |
} |
|
98,6 → 116,7 |
unsigned int argc; |
unsigned int scope; |
char *buff; |
char s[PATH_MAX]; |
|
DIR *dirp; |
struct dirent *dp; |