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

Function init_parameters

src/pr.c:1204–1314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1202/* Set parameters related to formatting. */
1203
1204static void
1205init_parameters (int number_of_files)
1206{
1207 int chars_used_by_number = 0;
1208
1209 lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
1210 if (lines_per_body <= 0)
1211 {
1212 extremities = false;
1213 keep_FF = true;
1214 }
1215 if (! extremities)
1216 lines_per_body = lines_per_page;
1217
1218 if (double_space)
1219 lines_per_body = MAX (1, lines_per_body / 2);
1220
1221 /* If input is stdin, cannot print parallel files. BSD dumps core
1222 on this. */
1223 if (number_of_files == 0)
1224 parallel_files = false;
1225
1226 if (parallel_files)
1227 columns = number_of_files;
1228
1229 /* One file, multi columns down: -b option is set to get a consistent
1230 formulation with "FF set by hand" in input files. */
1231 if (storing_columns)
1232 balance_columns = true;
1233
1234 /* Tabification is assumed for multiple columns. */
1235 if (columns > 1)
1236 {
1237 if (!use_col_separator)
1238 {
1239 /* Use default separator */
1240 if (join_lines)
1241 col_sep_string = line_separator;
1242 else
1243 col_sep_string = column_separator;
1244
1245 col_sep_length = 1;
1246 use_col_separator = true;
1247 }
1248 /* It's rather pointless to define a TAB separator with column
1249 alignment */
1250 else if (!join_lines && col_sep_length == 1 && *col_sep_string == '\t')
1251 col_sep_string = column_separator;
1252
1253 truncate_lines = true;
1254 if (! (col_sep_length == 1 && *col_sep_string == '\t'))
1255 untabify_input = true;
1256 tabify_output = true;
1257 }
1258 else
1259 storing_columns = false;
1260
1261 /* -J dominates -w in any case */

Callers 1

print_filesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected