[git commit] ls: lack of -q should not suppress -Q
Denys Vlasenko
vda.linux at googlemail.com
Thu Jul 31 17:24:08 UTC 2025
commit: https://git.busybox.net/busybox/commit/?id=bb18473216253b8602ce081dd944f854aad9e572
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
function old new delta
print_name 134 137 +3
display_files 374 375 +1
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 4/0) Total: 4 bytes
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
coreutils/ls.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/coreutils/ls.c b/coreutils/ls.c
index eaccd1a17..c725be92d 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -454,16 +454,17 @@ static unsigned calc_name_len(const char *name)
unsigned len;
uni_stat_t uni_stat;
- if (!(option_mask32 & OPT_q))
+ if (!(option_mask32 & (OPT_q|OPT_Q)))
return strlen(name);
- // TODO: quote tab as \t, etc, if -Q
name = printable_string2(&uni_stat, name);
if (!(option_mask32 & OPT_Q)) {
return uni_stat.unicode_width;
}
+ // TODO: quote chars 7..13 as \a,b,t,n,v,f,r
+ // other chars <32 or >127 as \ooo octal
len = 2 + uni_stat.unicode_width;
while (*name) {
if (*name == '"' || *name == '\\') {
@@ -486,12 +487,11 @@ static unsigned print_name(const char *name)
unsigned len;
uni_stat_t uni_stat;
- if (!(option_mask32 & OPT_q)) {
+ if (!(option_mask32 & (OPT_q|OPT_Q))) {
fputs_stdout(name);
return strlen(name);
}
- // TODO: quote tab as \t, etc, if -Q
name = printable_string2(&uni_stat, name);
if (!(option_mask32 & OPT_Q)) {
@@ -499,6 +499,8 @@ static unsigned print_name(const char *name)
return uni_stat.unicode_width;
}
+ // TODO: quote chars 7..13 as \a,b,t,n,v,f,r
+ // other chars <32 or >127 as \ooo octal
len = 2 + uni_stat.unicode_width;
putchar('"');
while (*name) {
More information about the busybox-cvs
mailing list