MCPcopy Create free account
hub / github.com/coreutils/coreutils / print_name_with_quoting

Function print_name_with_quoting

src/ls.c:4754–4788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4752}
4753
4754static size_t
4755print_name_with_quoting (const struct fileinfo *f,
4756 bool symlink_target,
4757 struct obstack *stack,
4758 size_t start_col)
4759{
4760 char const *name = symlink_target ? f->linkname : f->name;
4761
4762 const struct bin_str *color
4763 = print_with_color ? get_color_indicator (f, symlink_target) : NULL;
4764
4765 bool used_color_this_time = (print_with_color
4766 && (color || is_colored (C_NORM)));
4767
4768 size_t len = quote_name (name, filename_quoting_options, f->quoted,
4769 color, !symlink_target, stack, f->absolute_name);
4770
4771 process_signals ();
4772 if (used_color_this_time)
4773 {
4774 prep_non_filename_text ();
4775
4776 /* We use the byte length rather than display width here as
4777 an optimization to avoid accurately calculating the width,
4778 because we only output the clear to EOL sequence if the name
4779 _might_ wrap to the next line. This may output a sequence
4780 unnecessarily in multi-byte locales for example,
4781 but in that case it's inconsequential to the output. */
4782 if (line_length
4783 && (start_col / line_length != (start_col + len - 1) / line_length))
4784 put_indicator (&color_indicator[C_CLR_TO_EOL]);
4785 }
4786
4787 return len;
4788}
4789
4790static void
4791prep_non_filename_text (void)

Callers 2

print_long_formatFunction · 0.85

Calls 6

get_color_indicatorFunction · 0.85
is_coloredFunction · 0.85
quote_nameFunction · 0.85
prep_non_filename_textFunction · 0.85
put_indicatorFunction · 0.85
process_signalsFunction · 0.70

Tested by

no test coverage detected