… | |
… | |
449 | return 0; |
449 | return 0; |
450 | |
450 | |
451 | #if HAS_REGEX |
451 | #if HAS_REGEX |
452 | transform_line (logfile->buf); |
452 | transform_line (logfile->buf); |
453 | #endif |
453 | #endif |
454 | printf ("got buf <%s>\n", logfile->buf); |
|
|
455 | return 1; |
454 | return 1; |
456 | } |
455 | } |
457 | |
456 | |
458 | /* input: reads file->fname |
457 | /* input: reads file->fname |
459 | * output: fills file->fp, file->inode |
458 | * output: fills file->fp, file->inode |
… | |
… | |
671 | |
670 | |
672 | clearerr (current->fp); |
671 | clearerr (current->fp); |
673 | |
672 | |
674 | while (lineinput (current)) |
673 | while (lineinput (current)) |
675 | { |
674 | { |
676 | printf ("lineinput %s\n", current->buf);//D |
|
|
677 | need_update = 1; |
675 | need_update = 1; |
678 | /* if we're trying to update old partial lines in |
676 | /* if we're trying to update old partial lines in |
679 | * place, and the last time this file was updated the |
677 | * place, and the last time this file was updated the |
680 | * output was partial, and that partial line is not |
678 | * output was partial, and that partial line is not |
681 | * too close to the top of the screen, then update |
679 | * too close to the top of the screen, then update |
682 | * that partial line */ |
680 | * that partial line */ |
683 | printf ("BPa\n");//D |
|
|
684 | if (opt_update && current->lastpartial && current->index >= 3) |
681 | if (opt_update && current->lastpartial && current->index > 0) |
685 | { |
682 | { |
686 | append_line (current->index, current->buf); |
683 | append_line (current->index, current->buf); |
687 | |
|
|
688 | if (!current->partial) |
|
|
689 | { |
|
|
690 | free (current->buf); |
684 | free (current->buf), current->buf = 0; |
691 | current->buf = 0; |
|
|
692 | } |
|
|
693 | |
|
|
694 | continue; |
685 | continue; |
695 | } |
686 | } |
696 | |
687 | |
697 | printf ("BPb\n");//D |
|
|
698 | /* print filename if any, and if last line was from |
688 | /* print filename if any, and if last line was from |
699 | * different file */ |
689 | * different file */ |
700 | if (!opt_nofilename && |
|
|
701 | lastprinted != current && current->desc[0]) |
690 | if (!opt_nofilename && lastprinted != current && current->desc[0]) |
702 | { |
691 | { |
703 | char buf[1024]; /* HACK */ |
692 | char buf[1024]; /* HACK */ |
704 | snprintf (buf, sizeof (buf), "[%s]", current->desc); |
693 | snprintf (buf, sizeof (buf), "[%s]", current->desc); |
705 | printf ("BPc<%s>\n", buf);//D |
|
|
706 | split_line (listlen - 1, buf, current->color); |
694 | split_line (listlen - 1, buf, current->color); |
707 | } |
695 | } |
708 | |
696 | |
709 | printf ("BP1\n");//D |
|
|
710 | /* if this is the same file we showed last, and the |
697 | /* if this is the same file we showed last, and the |
711 | * last time we showed it, it wasn't finished, then |
698 | * last time we showed it, it wasn't finished, then |
712 | * append to the last line shown */ |
699 | * append to the last line shown */ |
713 | if (lastprinted == current && current->lastpartial) |
700 | if (lastprinted == current && current->lastpartial) |
714 | { |
701 | { |
715 | append_line (listlen - 1, current->buf); |
702 | append_line (listlen - 1, current->buf); |
716 | free (current->buf); |
703 | free (current->buf), current->buf = 0; |
717 | current->buf = 0; |
|
|
718 | continue; |
704 | continue; |
719 | } |
705 | } |
720 | else |
706 | else |
721 | { |
707 | { |
722 | split_line (listlen - 1, current->buf, current->color); |
708 | split_line (listlen - 1, current->buf, current->color); |
723 | free (current->buf); current->buf = 0; |
709 | free (current->buf), current->buf = 0; |
724 | } |
710 | } |
725 | printf ("BP3\n");//D |
|
|
726 | |
711 | |
727 | current->index = listlen - 1; |
712 | current->index = listlen - 1; |
728 | lastprinted = current; |
713 | lastprinted = current; |
729 | } |
714 | } |
730 | } |
715 | } |