forked from Bananymous/banan-os
ls: Print file name in quotes if it contains spaces
This commit is contained in:
parent
5bcfc9dd50
commit
5fa359c28d
|
@ -202,7 +202,8 @@ int list_directory(const BAN::String& path, config_t config)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
printf(" ");
|
printf(" ");
|
||||||
printf("%s%s\e[m", entry_color(entries[i].st.st_mode), entries[i].name.data());
|
const char* format = entries[i].name.sv().contains(' ') ? "'%s%s\e[m'" : "%s%s\e[m";
|
||||||
|
printf(format, entry_color(entries[i].st.st_mode), entries[i].name.data());
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue