Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/coreutils/tail.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1122 by niro, Sun May 30 11:32:42 2010 UTC revision 1123 by niro, Wed Aug 18 21:56:57 2010 UTC
# Line 35  static const struct suffix_mult tail_suf Line 35  static const struct suffix_mult tail_suf
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)
# Line 66  static ssize_t tail_read(int fd, char *b Line 66  static ssize_t tail_read(int fd, char *b
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  {  {
# Line 166  int tail_main(int argc, char **argv) Line 166  int tail_main(int argc, char **argv)
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;
# Line 181  int tail_main(int argc, char **argv) Line 181  int tail_main(int argc, char **argv)
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) {
# Line 333  int tail_main(int argc, char **argv) Line 333  int tail_main(int argc, char **argv)
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) {

Legend:
Removed from v.1122  
changed lines
  Added in v.1123