| 729 | that happens when we don't know how long the list of file names will be. */ |
| 730 | |
| 731 | static struct fstatus * |
| 732 | get_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 |