Rev 3834 | Rev 4266 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3834 | Rev 3945 | ||
|---|---|---|---|
| Line 112... | Line 112... | ||
| 112 | switch (scope) { |
112 | switch (scope) { |
| 113 | case LS_DIR: |
113 | case LS_DIR: |
| 114 | ls_print_dir(dp->d_name); |
114 | ls_print_dir(dp->d_name); |
| 115 | break; |
115 | break; |
| 116 | case LS_FILE: |
116 | case LS_FILE: |
| 117 | ls_print_file(dp->d_name); |
117 | ls_print_file(dp->d_name, buff); |
| 118 | break; |
118 | break; |
| 119 | case LS_BOGUS: |
119 | case LS_BOGUS: |
| 120 | /* Odd chance it was deleted from the time readdir() found |
120 | /* Odd chance it was deleted from the time readdir() found |
| 121 | * it and the time that it was scoped */ |
121 | * it and the time that it was scoped */ |
| 122 | printf("ls: skipping bogus node %s\n", dp->d_name); |
122 | printf("ls: skipping bogus node %s\n", dp->d_name); |
| Line 141... | Line 141... | ||
| 141 | printf("%-40s\t<dir>\n", d); |
141 | printf("%-40s\t<dir>\n", d); |
| 142 | 142 | ||
| 143 | return; |
143 | return; |
| 144 | } |
144 | } |
| 145 | 145 | ||
| 146 | static void ls_print_file(const char *f) |
146 | static void ls_print_file(const char *name, const char *pathname) |
| 147 | { |
147 | { |
| 148 | printf("%-40s\t%llu\n", f, (long long) flen(f)); |
148 | printf("%-40s\t%llu\n", name, (long long) flen(pathname)); |
| 149 | 149 | ||
| 150 | return; |
150 | return; |
| 151 | } |
151 | } |
| 152 | 152 | ||
| 153 | void help_cmd_ls(unsigned int level) |
153 | void help_cmd_ls(unsigned int level) |
| Line 190... | Line 190... | ||
| 190 | case LS_BOGUS: |
190 | case LS_BOGUS: |
| 191 | cli_error(CL_ENOENT, buff); |
191 | cli_error(CL_ENOENT, buff); |
| 192 | free(buff); |
192 | free(buff); |
| 193 | return CMD_FAILURE; |
193 | return CMD_FAILURE; |
| 194 | case LS_FILE: |
194 | case LS_FILE: |
| 195 | ls_print_file(buff); |
195 | ls_print_file(buff, buff); |
| 196 | break; |
196 | break; |
| 197 | case LS_DIR: |
197 | case LS_DIR: |
| 198 | dirp = opendir(buff); |
198 | dirp = opendir(buff); |
| 199 | if (! dirp) { |
199 | if (! dirp) { |
| 200 | /* May have been deleted between scoping it and opening it */ |
200 | /* May have been deleted between scoping it and opening it */ |