bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch #5353] Quick patch to colorize grep's own printout (filename, lin


From: anonymous
Subject: [patch #5353] Quick patch to colorize grep's own printout (filename, line number and byte marker)
Date: Thu, 31 Aug 2006 00:28:09 +0000
User-agent: Opera/9.00 (X11; Linux i686; U; en)

URL:
  <http://savannah.gnu.org/patch/?5353>

                 Summary: Quick patch to colorize grep's own printout
(filename, line number and byte marker)
                 Project: grep
            Submitted by: None
            Submitted on: Thursday 08/31/2006 at 00:28 UTC
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: address@hidden
             Open/Closed: Open

    _______________________________________________________

Details:

--- grep-2.5.1a/src/grep.c      2004-11-12 13:25:35.000000000 +0200
+++ grep-2.5.1a-new/src/grep.c  2006-08-31 03:19:22.000000000 +0300
@@ -76,6 +76,9 @@
    variable GREP_COLOR.  The default is to print red.  */
 static const char *grep_color = "01;31";
 
+/* The filename color string. The default is to print dark green.  */
+static const char *grep_color2 = "0;32";
+
 static struct exclude *excluded_patterns;
 static struct exclude *included_patterns;
 /* Short options.  */
@@ -512,6 +515,8 @@
 static void
 prline (char const *beg, char const *lim, int sep)
 {
+  if (color_option && (out_file || out_line || out_byte))
+    printf("\33[%sm", grep_color2);
   if (out_file)
     printf ("%s%c", filename, sep & filename_mask);
   if (out_line)
@@ -529,6 +534,8 @@
 #endif
       print_offset_sep (pos, sep);
     }
+  if (color_option && (out_file || out_line || out_byte))
+    fputs("\33[00m", stdout);
   if (only_matching)
     {
       size_t match_size;




    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
Available only the item webpage     | Originator Email




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?5353>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]