Lines Matching refs:p
420 static bool read_line (COLUMN *p);
422 static bool print_stored (COLUMN *p);
423 static bool open_file (char *name, COLUMN *p);
427 static void add_line_number (COLUMN *p);
442 static void read_rest_of_line (COLUMN *p);
443 static void skip_read (COLUMN *p, int column_number);
806 char *p; in first_last_page() local
809 strtol_error err = xstrtoumax (pages, &p, 10, &first, ""); in first_last_page()
813 if (p == pages || !first) in first_last_page()
816 if (*p == ':') in first_last_page()
818 char const *p1 = p + 1; in first_last_page()
819 err = xstrtoumax (p1, &p, 10, &last, ""); in first_last_page()
822 if (p1 == p || last < first) in first_last_page()
826 if (*p) in first_last_page()
1328 COLUMN *p; in init_fps() local
1338 for (p = column_vector; files_left--; ++p, ++av) in init_fps()
1340 if (! open_file (*av, p)) in init_fps()
1342 --p; in init_fps()
1352 p = column_vector; in init_fps()
1355 if (! open_file (*av, p)) in init_fps()
1357 init_header (*av, fileno (p->fp)); in init_fps()
1358 p->lines_stored = 0; in init_fps()
1362 p->name = _("standard input"); in init_fps()
1363 p->fp = stdin; in init_fps()
1365 p->status = OPEN; in init_fps()
1366 p->full_page_printed = false; in init_fps()
1369 p->lines_stored = 0; in init_fps()
1372 char const *firstname = p->name; in init_fps()
1373 FILE *firstfp = p->fp; in init_fps()
1375 for (i = columns - 1, ++p; i; --i, ++p) in init_fps()
1377 p->name = firstname; in init_fps()
1378 p->fp = firstfp; in init_fps()
1379 p->status = OPEN; in init_fps()
1380 p->full_page_printed = false; in init_fps()
1381 p->lines_stored = 0; in init_fps()
1398 COLUMN *p; in init_funcs() local
1421 for (p = column_vector, i = 1; i < columns; ++p, ++i) in init_funcs()
1425 p->char_func = store_char; in init_funcs()
1426 p->print_func = print_stored; in init_funcs()
1431 p->char_func = print_char; in init_funcs()
1432 p->print_func = read_line; in init_funcs()
1437 p->numbered = numbered_lines && (!parallel_files || i == 1); in init_funcs()
1438 p->start_position = h; in init_funcs()
1462 p->char_func = store_char; in init_funcs()
1463 p->print_func = print_stored; in init_funcs()
1467 p->char_func = print_char; in init_funcs()
1468 p->print_func = read_line; in init_funcs()
1471 p->numbered = numbered_lines && (!parallel_files || i == 1); in init_funcs()
1472 p->start_position = h; in init_funcs()
1481 open_file (char *name, COLUMN *p) in open_file() argument
1485 p->name = _("standard input"); in open_file()
1486 p->fp = stdin; in open_file()
1491 p->name = name; in open_file()
1492 p->fp = fopen (name, "r"); in open_file()
1494 if (p->fp == nullptr) in open_file()
1501 fadvise (p->fp, FADVISE_SEQUENTIAL); in open_file()
1502 p->status = OPEN; in open_file()
1503 p->full_page_printed = false; in open_file()
1514 close_file (COLUMN *p) in close_file() argument
1519 if (p->status == CLOSED) in close_file()
1523 if (!ferror (p->fp)) in close_file()
1525 if (fileno (p->fp) == STDIN_FILENO) in close_file()
1526 clearerr (p->fp); in close_file()
1527 else if (fclose (p->fp) != 0 && !err) in close_file()
1530 error (EXIT_FAILURE, err, "%s", quotef (p->name)); in close_file()
1545 p->status = CLOSED; in close_file()
1546 p->lines_to_print = 0; in close_file()
1559 hold_file (COLUMN *p) in hold_file() argument
1573 p->status = ON_HOLD; in hold_file()
1575 p->lines_to_print = 0; in hold_file()
1586 COLUMN *p; in reset_status() local
1588 for (p = column_vector; i; --i, ++p) in reset_status()
1589 if (p->status == ON_HOLD) in reset_status()
1591 p->status = OPEN; in reset_status()
1703 COLUMN *p; in init_page() local
1708 for (j = columns - 1, p = column_vector; j; --j, ++p) in init_page()
1710 p->lines_to_print = p->lines_stored; in init_page()
1716 p->lines_to_print = p->lines_stored; in init_page()
1722 if (p->status == OPEN) in init_page()
1724 p->lines_to_print = lines_per_body; in init_page()
1727 p->lines_to_print = 0; in init_page()
1731 for (j = columns, p = column_vector; j; --j, ++p) in init_page()
1732 if (p->status == OPEN) in init_page()
1734 p->lines_to_print = lines_per_body; in init_page()
1737 p->lines_to_print = 0; in init_page()
1745 align_column (COLUMN *p) in align_column() argument
1747 padding_not_printed = p->start_position; in align_column()
1757 if (p->numbered) in align_column()
1758 add_line_number (p); in align_column()
1777 COLUMN *p; in print_page() local
1813 for (j = 1, p = column_vector; j <= columns; ++j, ++p) in print_page()
1816 if (p->lines_to_print > 0 || p->status == FF_FOUND) in print_page()
1819 padding_not_printed = p->start_position; in print_page()
1820 if (!(p->print_func) (p)) in print_page()
1821 read_rest_of_line (p); in print_page()
1824 --p->lines_to_print; in print_page()
1825 if (p->lines_to_print <= 0) in print_page()
1832 if (parallel_files && p->status != OPEN) in print_page()
1836 else if (p->status == CLOSED in print_page()
1837 || (p->status == ON_HOLD && FF_only)) in print_page()
1838 align_column (p); in print_page()
1847 align_column (p); in print_page()
1872 for (j = 1, p = column_vector; j <= columns; ++j, ++p) in print_page()
1873 if (p->status == OPEN) in print_page()
1874 p->full_page_printed = true; in print_page()
1950 COLUMN *p; in store_columns() local
1960 for (i = 1, p = column_vector; i <= last_col; ++i, ++p) in store_columns()
1961 p->lines_stored = 0; in store_columns()
1963 for (i = 1, p = column_vector; i <= last_col && files_ready_to_read; in store_columns()
1964 ++i, ++p) in store_columns()
1966 p->current_line = line; in store_columns()
1969 if (p->status == OPEN) /* Redundant. Clean up. */ in store_columns()
1973 if (!read_line (p)) in store_columns()
1974 read_rest_of_line (p); in store_columns()
1976 if (p->status == OPEN in store_columns()
1979 ++p->lines_stored; in store_columns()
1997 COLUMN *p; in balance() local
2001 for (i = 1, p = column_vector; i <= columns; ++i, ++p) in balance()
2007 p->lines_stored = lines; in balance()
2008 p->current_line = first_line; in balance()
2028 add_line_number (COLUMN *p) in add_line_number() argument
2040 (p->char_func) (*s++); in add_line_number()
2051 (p->char_func) (' '); in add_line_number()
2054 (p->char_func) (number_separator); in add_line_number()
2061 (p->char_func) (number_separator); in add_line_number()
2111 read_rest_of_line (COLUMN *p) in read_rest_of_line() argument
2114 FILE *f = p->fp; in read_rest_of_line()
2124 hold_file (p); in read_rest_of_line()
2129 close_file (p); in read_rest_of_line()
2145 skip_read (COLUMN *p, int column_number) in skip_read() argument
2148 FILE *f = p->fp; in skip_read()
2154 if ((c = getc (f)) == '\f' && p->full_page_printed) in skip_read()
2160 p->full_page_printed = false; in skip_read()
2170 p->full_page_printed = true; in skip_read()
2184 p->full_page_printed = false; in skip_read()
2189 hold_file (p); in skip_read()
2194 close_file (p); in skip_read()
2282 print_clump (COLUMN *p, int n, char *clump) in print_clump() argument
2285 (p->char_func) (*clump++); in print_clump()
2330 COLUMN *p; in skip_to_page() local
2335 for (j = 1, p = column_vector; j <= columns; ++j, ++p) in skip_to_page()
2336 if (p->status == OPEN) in skip_to_page()
2337 skip_read (p, j); in skip_to_page()
2340 for (j = 1, p = column_vector; j <= columns; ++j, ++p) in skip_to_page()
2341 if (p->status == OPEN) in skip_to_page()
2342 skip_read (p, j); in skip_to_page()
2345 for (j = 1, p = column_vector; j <= columns; ++j, ++p) in skip_to_page()
2346 if (p->status != CLOSED) in skip_to_page()
2347 p->status = ON_HOLD; in skip_to_page()
2425 read_line (COLUMN *p) in read_line() argument
2434 c = getc (p->fp); in read_line()
2438 if (c == '\f' && p->full_page_printed) in read_line()
2439 if ((c = getc (p->fp)) == '\n') in read_line()
2440 c = getc (p->fp); in read_line()
2441 p->full_page_printed = false; in read_line()
2446 if ((c = getc (p->fp)) != '\n') in read_line()
2447 ungetc (c, p->fp); in read_line()
2456 hold_file (p); in read_line()
2459 close_file (p); in read_line()
2473 if (p->char_func != store_char) in read_line()
2490 padding_not_printed = p->start_position; in read_line()
2508 if (p->numbered) in read_line()
2509 add_line_number (p); in read_line()
2515 print_clump (p, chars, clump_buff); in read_line()
2519 c = getc (p->fp); in read_line()
2526 if ((c = getc (p->fp)) != '\n') in read_line()
2527 ungetc (c, p->fp); in read_line()
2530 hold_file (p); in read_line()
2533 close_file (p); in read_line()
2545 print_clump (p, chars, clump_buff); in read_line()
2564 print_stored (COLUMN *p) in print_stored() argument
2568 int line = p->current_line++; in print_stored()
2588 if (p->status == FF_FOUND) in print_stored()
2615 output_position = p->start_position + end_vector[line]; in print_stored()
2616 if (p->start_position - col_sep_length == chars_per_margin) in print_stored()