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

Function fmt

src/fmt.c:492–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490 Return true if successful. */
491
492static bool
493fmt (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. */

Callers 1

mainFunction · 0.85

Calls 5

fadviseFunction · 0.85
get_prefixFunction · 0.85
get_paragraphFunction · 0.85
fmt_paragraphFunction · 0.85
put_paragraphFunction · 0.85

Tested by

no test coverage detected