1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

Ls: Support multiple files

This commit is contained in:
faissaloo 2019-05-27 13:30:09 +01:00 committed by Andreas Kling
parent 776a359a17
commit 4c410f3de6
Notes: sideshowbarker 2024-07-19 13:54:50 +09:00

View file

@ -38,21 +38,37 @@ int main(int argc, char** argv)
flag_show_inode = true;
break;
default:
fprintf(stderr, "usage: ls [-%s] [path]\n", valid_option_characters);
fprintf(stderr, "usage: ls [-%s] [paths...]\n", valid_option_characters);
return 1;
}
}
const char* path;
int status;
if (optind >= argc) {
if (flag_long) {
status = do_dir(".");
} else {
status = do_dir_short(".");
}
return status;
} else {
bool show_names = !(optind+1 >= argc);
if (optind >= argc)
path = ".";
else
path = argv[optind];
if (flag_long)
return do_dir(path);
return do_dir_short(path);
for (; optind < argc; optind++) {
if (show_names) {
printf("%s:\n", argv[optind]);
}
if (flag_long) {
status = do_dir(argv[optind]);
} else {
status = do_dir_short(argv[optind]);
}
if (status != 0) {
return status;
}
}
}
return 0;
}
void get_geometry(int& rows, int& columns)