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.13 by pcg, Sat Mar 27 01:35:58 2004 UTC vs.
Revision 1.14 by pcg, Sat Mar 27 14:47:27 2004 UTC

542 e->last_size = stats.st_size; 542 e->last_size = stats.st_size;
543 } 543 }
544 } 544 }
545} 545}
546 546
547/*
548 * insert a single physical line (that must be short enough to fit)
549 * at position "idx" by pushing up lines above it. the caller
550 * MUST then fill in lines[idx] with valid data.
551 */
547static void 552static void
548insert_line (int idx) 553insert_line (int idx)
549{ 554{
550 int cur_line; 555 int cur_line;
551 struct logfile_entry *current; 556 struct logfile_entry *current;
558 for (current = loglist; current; current = current->next) 563 for (current = loglist; current; current = current->next)
559 if (current->partial && current->index && current->index <= idx) 564 if (current->partial && current->index && current->index <= idx)
560 current->index--; 565 current->index--;
561} 566}
562 567
568/*
569 * remove a single physical line at position "idx" by moving the lines above it
570 * down and inserting a "~" line at the top.
571 */
563static void 572static void
564delete_line (int idx) 573delete_line (int idx)
565{ 574{
566 int cur_line; 575 int cur_line;
567 struct logfile_entry *current; 576 struct logfile_entry *current;
574 for (current = loglist; current; current = current->next) 583 for (current = loglist; current; current = current->next)
575 if (current->partial && current->index && current->index <= idx) 584 if (current->partial && current->index && current->index <= idx)
576 current->index++; 585 current->index++;
577} 586}
578 587
588/*
589 * takes a logical log file line and split it into multiple physical
590 * screen lines by splitting it whenever a part becomes too long.
591 * lal lines will be inserted at position "idx".
592 */
579static void 593static void
580split_line (int idx, const char *str, unsigned long color) 594split_line (int idx, const char *str, unsigned long color)
581{ 595{
582 int l = strlen (str); 596 int l = strlen (str);
583 const char *p = str; 597 const char *p = str;
613 } 627 }
614 } 628 }
615 while (l); 629 while (l);
616} 630}
617 631
632/*
633 * append something to an existing physical line. this is done
634 * by deleting the file on-screen, concatenating the new data to it
635 * and splitting it again.
636 */
618static void 637static void
619append_line (int idx, const char *str) 638append_line (int idx, const char *str)
620{ 639{
621 unsigned long color = lines[idx].color; 640 unsigned long color = lines[idx].color;
622 char *old = lines[idx].line; 641 char *old = lines[idx].line;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines