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.31 by chris_moore, Tue Mar 30 23:23:46 2004 UTC vs.
Revision 1.32 by chris_moore, Tue Mar 30 23:33:59 2004 UTC

530 530
531 return r; 531 return r;
532} 532}
533 533
534/* 534/*
535 * This routine should read a single line, no matter how long. 535 * HACK-1: This routine should read a single line, no matter how long.
536 */ 536 */
537int 537int
538lineinput (struct logfile_entry *logfile) 538lineinput (struct logfile_entry *logfile)
539{ 539{
540 char buff[1024], *p = buff; 540 char buff[1024], *p = buff;
541 int ch; 541 int ch;
542 /* HACK this - to add on the length of any partial line which we will be appending to */ 542 /* HACK-2: add on the length of any partial line which we will be appending to */
543 int ofs = logfile->buf ? strlen (logfile->buf) : 0; 543 int ofs = logfile->buf ? strlen (logfile->buf) : 0;
544 544
545 do 545 do
546 { 546 {
547 ch = fgetc (logfile->fp); 547 ch = fgetc (logfile->fp);
662 fclose (e->fp); 662 fclose (e->fp);
663 if (openlog (e) == NULL) 663 if (openlog (e) == NULL)
664 continue; 664 continue;
665 } 665 }
666 666
667 /* HACK this - stats can be uninitialised here (if the file 667 /* HACK-3: stats can be uninitialised here (if the file didn't
668 * didn't exist when stat() was called, but was recreated during 668 * exist when stat() was called, but was recreated during the
669 * the sleep(1)) */ 669 * sleep(1)) */
670 if (stats.st_ino != e->inode) 670 if (stats.st_ino != e->inode)
671 { /* file renamed? */ 671 { /* file renamed? */
672 if (e->fp) 672 if (e->fp)
673 fclose (e->fp); 673 fclose (e->fp);
674 if (openlog (e) == NULL) 674 if (openlog (e) == NULL)
772 l += p - break_p; 772 l += p - break_p;
773 p = break_p; 773 p = break_p;
774 } 774 }
775 775
776 { 776 {
777 /* HACK-4 - consider inserting the 'continuation string'
778 * before the rest of the wrapped line */
777 char *s = xmalloc (p - beg + 1); 779 char *s = xmalloc (p - beg + 1);
778 memcpy (s, beg, p - beg); 780 memcpy (s, beg, p - beg);
779 s[p - beg] = 0; 781 s[p - beg] = 0;
780 insert_line (idx); 782 insert_line (idx);
781 lines[idx].line = s; 783 lines[idx].line = s;
866 868
867 /* print filename if any, and if last line was from 869 /* print filename if any, and if last line was from
868 * different file */ 870 * different file */
869 if (!opt_nofilename && lastprinted != current && current->desc[0]) 871 if (!opt_nofilename && lastprinted != current && current->desc[0])
870 { 872 {
871 char buf[1024]; /* HACK */ 873 char buf[1024]; /* HACK-5 */
872 snprintf (buf, sizeof (buf), "[%s]", current->desc); 874 snprintf (buf, sizeof (buf), "[%s]", current->desc);
873 split_line (listlen - 1, buf, current->color); 875 split_line (listlen - 1, buf, current->color);
874 } 876 }
875 877
876 /* if we're dealing with partial lines, and the last 878 /* if we're dealing with partial lines, and the last
1117 e->fname = xstrdup (fname); 1119 e->fname = xstrdup (fname);
1118 if (openlog (e) == NULL) 1120 if (openlog (e) == NULL)
1119 perror (fname), exit (1); 1121 perror (fname), exit (1);
1120 1122
1121 l = strlen (desc); 1123 l = strlen (desc);
1122 /* HACK on this - width is in pixels now */ 1124 /* HACK-6: width is in pixels now */
1123 if (l > width - 2) /* must account for [ ] */ 1125 if (l > width - 2) /* must account for [ ] */
1124 l = width - 2; 1126 l = width - 2;
1125 e->desc = xmalloc (l + 1); 1127 e->desc = xmalloc (l + 1);
1126 memcpy (e->desc, desc, l); 1128 memcpy (e->desc, desc, l);
1127 *(e->desc + l) = '\0'; 1129 *(e->desc + l) = '\0';
1150 { 1152 {
1151 fprintf (stderr, "Specify at most one of -partial and -whole\n"); 1153 fprintf (stderr, "Specify at most one of -partial and -whole\n");
1152 exit (1); 1154 exit (1);
1153 } 1155 }
1154 1156
1155 /* HACK this - do we want to allow both -shade and -outline? */ 1157 /* HACK-7: do we want to allow both -shade and -outline? */
1156 if (opt_shade && opt_outline) 1158 if (opt_shade && opt_outline)
1157 { 1159 {
1158 fprintf (stderr, "Specify at most one of -shade and -outline\n"); 1160 fprintf (stderr, "Specify at most one of -shade and -outline\n");
1159 exit (1); 1161 exit (1);
1160 } 1162 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines