| 5158 | /* Output name + SEP + ' '. */ |
| 5159 | |
| 5160 | static void |
| 5161 | print_with_separator (char sep) |
| 5162 | { |
| 5163 | size_t pos = 0; |
| 5164 | |
| 5165 | for (idx_t filesno = 0; filesno < cwd_n_used; filesno++) |
| 5166 | { |
| 5167 | struct fileinfo const *f = sorted_file[filesno]; |
| 5168 | size_t len = line_length ? length_of_file_name_and_frills (f) : 0; |
| 5169 | |
| 5170 | if (filesno != 0) |
| 5171 | { |
| 5172 | char separator; |
| 5173 | |
| 5174 | if (! line_length |
| 5175 | || ((pos + len + 2 < line_length) |
| 5176 | && (pos <= SIZE_MAX - len - 2))) |
| 5177 | { |
| 5178 | pos += 2; |
| 5179 | separator = ' '; |
| 5180 | } |
| 5181 | else |
| 5182 | { |
| 5183 | pos = 0; |
| 5184 | separator = eolbyte; |
| 5185 | } |
| 5186 | |
| 5187 | putchar (sep); |
| 5188 | putchar (separator); |
| 5189 | } |
| 5190 | |
| 5191 | print_file_name_and_frills (f, pos); |
| 5192 | pos += len; |
| 5193 | } |
| 5194 | putchar (eolbyte); |
| 5195 | } |
| 5196 | |
| 5197 | /* Assuming cursor is at position FROM, indent up to position TO. |
| 5198 | Use a TAB character instead of two or more spaces whenever possible. */ |
no test coverage detected