ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/root-tail/root-tail.c
(Generate patch)

Comparing root-tail/root-tail.c (file contents):
Revision 1.17 by pcg, Sat Mar 27 15:59:20 2004 UTC vs.
Revision 1.18 by pcg, Sat Mar 27 16:12:00 2004 UTC

414 414
415 do 415 do
416 { 416 {
417 ch = fgetc (logfile->fp); 417 ch = fgetc (logfile->fp);
418 418
419 if (ch == EOF) 419 if (ch == '\n' || ch == EOF)
420 {
421 fseek (logfile->fp, 0L, SEEK_CUR);
422 break; 420 break;
423 }
424 else if (ch == '\r') 421 else if (ch == '\r')
425 continue; 422 continue; /* skip */
426 else if (ch == '\n')
427 break;
428 else if (ch == '\t') 423 else if (ch == '\t')
429 { 424 {
430 do 425 do
431 { 426 {
432 *p++ = ' '; 427 *p++ = ' ';
663 time_t lastreload; 658 time_t lastreload;
664 Region region = XCreateRegion (); 659 Region region = XCreateRegion ();
665 XEvent xev; 660 XEvent xev;
666 struct logfile_entry *lastprinted = NULL; 661 struct logfile_entry *lastprinted = NULL;
667 struct logfile_entry *current; 662 struct logfile_entry *current;
663 int need_update = 1;
668 664
669 maxy = 0; 665 maxy = 0;
670 miny = win_y + height; 666 miny = win_y + height;
671 lastreload = time (NULL); 667 lastreload = time (NULL);
672 668
676 lines[lin].line = strdup ("~"); 672 lines[lin].line = strdup ("~");
677 lines[lin].len = 1; 673 lines[lin].len = 1;
678 lines[lin].color = GetColor (def_color); 674 lines[lin].color = GetColor (def_color);
679 } 675 }
680 676
681 /* show the display full of empty lines ("~") in case the first
682 * time around the loop doesn't produce any output, as it won't if
683 * either (a) -noinitial is set or (b) all the files are currently
684 * empty */
685 redraw ();
686
687 for (;;) 677 for (;;)
688 { 678 {
689 int need_update = 0;
690
691 /* read logs */ 679 /* read logs */
692 for (current = loglist; current; current = current->next) 680 for (current = loglist; current; current = current->next)
693 { 681 {
694 if (!current->fp) 682 if (!current->fp)
695 continue; /* skip missing files */ 683 continue; /* skip missing files */
696 684
697 clearerr (current->fp); 685 clearerr (current->fp);
698 686
699 while (lineinput (current)) 687 while (lineinput (current))
700 { 688 {
689 fprintf (stderr, "got line <%s>\n", current->buf);//D
701 need_update = 1; 690 need_update = 1;
702 /* if we're trying to update old partial lines in 691 /* if we're trying to update old partial lines in
703 * place, and the last time this file was updated the 692 * place, and the last time this file was updated the
704 * output was partial, and that partial line is not 693 * output was partial, and that partial line is not
705 * too close to the top of the screen, then update 694 * too close to the top of the screen, then update
741 lastprinted = current; 730 lastprinted = current;
742 } 731 }
743 } 732 }
744 733
745 if (need_update) 734 if (need_update)
735 {
746 redraw (); 736 redraw ();
737 need_update = 0;
738 }
747 else 739 else
748 { 740 {
749 XFlush (disp); 741 XFlush (disp);
750 742
751 if (!XPending (disp)) 743 if (!XPending (disp))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines