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

Function get_input_fstatus

src/wc.c:731–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729 that happens when we don't know how long the list of file names will be. */
730
731static struct fstatus *
732get_input_fstatus (idx_t nfiles, char *const *file)
733{
734 struct fstatus *fstatus = xnmalloc (nfiles ? nfiles : 1, sizeof *fstatus);
735
736 if (nfiles == 0
737 || (nfiles == 1
738 && ((print_lines + print_words + print_chars
739 + print_bytes + print_linelength)
740 == 1)))
741 fstatus[0].failed = 1;
742 else
743 {
744 for (idx_t i = 0; i < nfiles; i++)
745 fstatus[i].failed = (! file[i] || streq (file[i], "-")
746 ? fstat (STDIN_FILENO, &fstatus[i].st)
747 : stat (file[i], &fstatus[i].st));
748 }
749
750 return fstatus;
751}
752
753/* Return a print width suitable for the NFILES files whose status is
754 recorded in FSTATUS. Optimize the same special case that

Callers 1

mainFunction · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected