| 490 | Return true if successful. */ |
| 491 | |
| 492 | static bool |
| 493 | fmt (FILE *f, char const *file) |
| 494 | { |
| 495 | fadvise (f, FADVISE_SEQUENTIAL); |
| 496 | tabs = false; |
| 497 | other_indent = 0; |
| 498 | next_char = get_prefix (f); |
| 499 | while (get_paragraph (f)) |
| 500 | { |
| 501 | fmt_paragraph (); |
| 502 | put_paragraph (word_limit); |
| 503 | } |
| 504 | |
| 505 | int err = ferror (f) ? 0 : -1; |
| 506 | /* err < 0 means success. */ |
| 507 | if (f == stdin) |
| 508 | clearerr (f); |
| 509 | else if (fclose (f) != 0 && err < 0) |
| 510 | err = errno; |
| 511 | if (0 <= err) |
| 512 | { |
| 513 | if (f == stdin) |
| 514 | error (0, errno, _("read error")); |
| 515 | else |
| 516 | error (0, errno, _("error reading %s"), quoteaf (file)); |
| 517 | } |
| 518 | return err < 0; |
| 519 | } |
| 520 | |
| 521 | /* Set the global variable 'other_indent' according to SAME_PARAGRAPH |
| 522 | and other global variables. */ |
no test coverage detected