+ }
+ argv[nfiles] = argv[i];
+ ++nfiles;
+ } while (++i < argc);
+
+ if (!nfiles) {
+ bb_error_msg_and_die("no files");
+ }
+
+ tailbufsize = BUFSIZ;
+
+ /* tail the files */
+ if (from_top < count_bytes) { /* Each is 0 or 1, so true iff 0 < 1. */
+ /* Hence, !from_top && count_bytes */
+ if (tailbufsize < count) {
+ tailbufsize = count + BUFSIZ;
+ }
+ }
+
+ buf = tailbuf = xmalloc(tailbufsize);
+
+ fmt = header_fmt + 1; /* Skip header leading newline on first output. */
+ i = 0;
+ do {
+ /* Be careful. It would be possible to optimize the count-bytes
+ * case if the file is seekable. If you do though, remember that
+ * starting file position may not be the beginning of the file.
+ * Beware of backing up too far. See example in wc.c.
+ */
+ if ((!(count|from_top)) && (lseek(fds[i], 0, SEEK_END) >= 0)) {