LINUX.ORG.RU

помогите хакнуть root-tail


0

0

всем доброго вечера.

т.к. я не девелопер, и в сях разбираюсь не очень хорошо, прошу помощи:

имеется программка - root-tail, основное орудие админа :))

в общем, можно заставить эту программку одновременно 
выводить на экран несколько логов (можно даже разными цветами).
Соответственно получаем картинку такого вида: www.1sm.ru/rt-is.png 
А хотелось бы чтобы было что-то вроде www.1sm.ru/rt-wanted.png

а вот код из root-tail.c, отвечающий за эти названия файлов:

          while (lineinput (current))
            {
              need_update = 1;
              /* if we're trying to update old partial lines in
               * place, and the last time this file was updated the
               * output was partial, and that partial line is not
               * too close to the top of the screen, then update
               * that partial line */
              if (opt_update && current->lastpartial && current->last)
                {
                  append_to_existing_line (current->buf, current);
                  current->buf = 0;
                  continue;
                }

              /* if all we just read was a newline ending a line that we've already displayed, skip it */
              if (current->buf[0] == '\0' && current->lastpartial)
                {
                  free(current->buf);
                  current->buf = 0;
                  continue;
                }

              /* print filename if any, and if last line was from
               * different file */
              if (lastprinted != current)
                {
                  current->last = 0;
                  if (!opt_nofilename && current->desc[0])
                    {
                      insert_new_line (xstrdup ("["), current);
                      append_to_existing_line (xstrdup (current->desc), current);
                      append_to_existing_line (xstrdup ("]"), current);
                    }
                }

              /* if we're dealing with partial lines, and the last
               * time we showed the line it wasn't finished ... */
              if (!opt_whole && current->lastpartial)
                {
                  /* if this is the same file we showed last then
                     append to the last line shown */
                  if (lastprinted == current)
                    append_to_existing_line (current->buf, current);
                  else
                    {
                      /* but if a different file has been shown in the
                       * mean time, make a new line, starting with the
                       * continuation string */
                      insert_new_line (current->buf, current);
                      current->last->wrapped_left = 1;
                    }
                }
              else
                /* otherwise just make a plain and simple new line */
                insert_new_line (current->buf, current);

              current->buf = 0;
              lastprinted = current;
            }
        }
★★★★

забыл дописать - всем большое спасибо заранее за патч, с меня пиво при встрече.

сам ессно пытался это сделать, но видимо руки не оттуда растут или сабжевых знаний маловато :))

gr_buza ★★★★
() автор топика

--- root-tail.c.orig	2004-07-30 23:33:20.000000000 +0400
+++ root-tail.c	2006-08-02 14:44:20.000000000 +0400
@@ -1161,12 +1161,6 @@
               if (lastprinted != current)
 		{
                   current->last = 0;
-		  if (!opt_nofilename && current->desc[0])
-		    {
-		      insert_new_line (xstrdup ("["), current);
-		      append_to_existing_line (xstrdup (current->desc), current);
-		      append_to_existing_line (xstrdup ("]"), current);
-		    }
 		}
 
               /* if we're dealing with partial lines, and the last

eXire ★★
()
Ответ на: комментарий от gr_buza

И еще, вот что написано в мане:
All non-option arguments on the comamnd line are files to be logged. A null desc (example: "/var/log/messages,red,") will prevent the printing of a description and the []'s.

eXire ★★
()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.