35 |
|
|
36 |
struct globals { |
struct globals { |
37 |
bool status; |
bool status; |
38 |
}; |
} FIX_ALIASING; |
39 |
#define G (*(struct globals*)&bb_common_bufsiz1) |
#define G (*(struct globals*)&bb_common_bufsiz1) |
40 |
|
|
41 |
static void tail_xprint_header(const char *fmt, const char *filename) |
static void tail_xprint_header(const char *fmt, const char *filename) |
66 |
return r; |
return r; |
67 |
} |
} |
68 |
|
|
69 |
static const char header_fmt[] ALIGN1 = "\n==> %s <==\n"; |
#define header_fmt_str "\n==> %s <==\n" |
70 |
|
|
71 |
static unsigned eat_num(const char *p) |
static unsigned eat_num(const char *p) |
72 |
{ |
{ |
166 |
tailbuf = xmalloc(tailbufsize); |
tailbuf = xmalloc(tailbufsize); |
167 |
|
|
168 |
/* tail the files */ |
/* tail the files */ |
169 |
fmt = header_fmt + 1; /* skip header leading newline on first output */ |
fmt = header_fmt_str + 1; /* skip header leading newline on first output */ |
170 |
i = 0; |
i = 0; |
171 |
do { |
do { |
172 |
char *buf; |
char *buf; |
181 |
|
|
182 |
if (nfiles > header_threshhold) { |
if (nfiles > header_threshhold) { |
183 |
tail_xprint_header(fmt, argv[i]); |
tail_xprint_header(fmt, argv[i]); |
184 |
fmt = header_fmt; |
fmt = header_fmt_str; |
185 |
} |
} |
186 |
|
|
187 |
if (!from_top) { |
if (!from_top) { |
333 |
if (ENABLE_FEATURE_FANCY_TAIL && fd < 0) |
if (ENABLE_FEATURE_FANCY_TAIL && fd < 0) |
334 |
continue; |
continue; |
335 |
if (nfiles > header_threshhold) { |
if (nfiles > header_threshhold) { |
336 |
fmt = header_fmt; |
fmt = header_fmt_str; |
337 |
} |
} |
338 |
while ((nread = tail_read(fd, tailbuf, BUFSIZ)) > 0) { |
while ((nread = tail_read(fd, tailbuf, BUFSIZ)) > 0) { |
339 |
if (fmt) { |
if (fmt) { |