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

Function print_sep_string

src/pr.c:2244–2284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2242 then print_sep_string() is called. */
2243
2244static void
2245print_sep_string (void)
2246{
2247 char const *s = col_sep_string;
2248 int l = col_sep_length;
2249
2250 if (separators_not_printed <= 0)
2251 {
2252 /* We'll be starting a line with chars_per_margin, anything else? */
2253 if (spaces_not_printed > 0)
2254 print_white_space ();
2255 }
2256 else
2257 {
2258 for (; separators_not_printed > 0; --separators_not_printed)
2259 {
2260 while (l-- > 0)
2261 {
2262 /* 3 types of sep_strings: spaces only, spaces and chars,
2263 chars only */
2264 if (*s == ' ')
2265 {
2266 /* We're tabifying output; consecutive spaces in
2267 sep_string may have to be converted to tabs */
2268 s++;
2269 ++spaces_not_printed;
2270 }
2271 else
2272 {
2273 if (spaces_not_printed > 0)
2274 print_white_space ();
2275 putchar (*s++);
2276 ++output_position;
2277 }
2278 }
2279 /* sep_string ends with some spaces */
2280 if (spaces_not_printed > 0)
2281 print_white_space ();
2282 }
2283 }
2284}
2285
2286/* Print (or store, depending on p->char_func) a clump of N
2287 characters. */

Callers 3

align_columnFunction · 0.85
read_lineFunction · 0.85
print_storedFunction · 0.85

Calls 1

print_white_spaceFunction · 0.85

Tested by

no test coverage detected