* [PATCH] dmesg colorized output
@ 2012-10-10 7:44 Ondrej Oprala
2012-10-10 9:19 ` Karel Zak
0 siblings, 1 reply; 5+ messages in thread
From: Ondrej Oprala @ 2012-10-10 7:44 UTC (permalink / raw)
To: util-linux
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
Hi, this patch should implement the dmesg entry in your TODO list.
I've also created a tiny colors module, which should be enough for
simple output coloring for other programs in the future.
Cheers,
Ondrej.
[-- Attachment #2: DIFF --]
[-- Type: text/plain, Size: 5507 bytes --]
>From 1a89c8497525030c8710c3936aa8d558976f0502 Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <ooprala@redhat.com>
Date: Tue, 9 Oct 2012 12:32:55 +0200
Subject: [PATCH] dmesg: Add a --color option to colorize error and panic
messages
---
include/colors.h | 19 +++++++++++++++++++
lib/Makemodule.am | 1 +
lib/colors.c | 20 ++++++++++++++++++++
sys-utils/dmesg.c | 28 ++++++++++++++++++++++++----
4 files changed, 64 insertions(+), 4 deletions(-)
create mode 100644 include/colors.h
create mode 100644 lib/colors.c
diff --git a/include/colors.h b/include/colors.h
new file mode 100644
index 0000000..90b62a7
--- /dev/null
+++ b/include/colors.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
+ *
+ * This file may be distributed under the terms of the
+ * GNU Lesser General Public License.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#define CLR_RST "\033[0m"
+
+/*
+ * Set output colors according to CLR_SCHEME, which should
+ * be in ANSI color code format
+ */
+extern void set_clr(const char *clr_scheme, FILE *out);
+
+/* Reset to default */
+extern void rst_clr(FILE *out);
diff --git a/lib/Makemodule.am b/lib/Makemodule.am
index 33a3eb8..3c89fb8 100644
--- a/lib/Makemodule.am
+++ b/lib/Makemodule.am
@@ -5,6 +5,7 @@ libcommon_la_SOURCES = \
lib/at.c \
lib/blkdev.c \
lib/canonicalize.c \
+ lib/colors.c \
lib/cpuset.c \
lib/crc32.c \
lib/env.c \
diff --git a/lib/colors.c b/lib/colors.c
new file mode 100644
index 0000000..0e03f98
--- /dev/null
+++ b/lib/colors.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
+ *
+ * This file may be distributed under the terms of the
+ * GNU Lesser General Public License.
+ */
+
+#include "colors.h"
+
+void set_clr(const char *clr_scheme, FILE *out)
+{
+ if (isatty(fileno(out)))
+ fprintf(out, clr_scheme);
+}
+
+void rst_clr(FILE *out)
+{
+ if (isatty(fileno(out)))
+ fprintf(out, CLR_RST);
+}
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 4c85f9f..fc384d7 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -23,6 +23,7 @@
#include <fcntl.h>
#include "c.h"
+#include "colors.h"
#include "nls.h"
#include "strutils.h"
#include "xalloc.h"
@@ -33,6 +34,11 @@
#include "optutils.h"
#include "mangle.h"
+#define K_PANIC 1
+#define K_ERR 3
+#define CLR_PANIC "\033[31m" //Red
+#define CLR_ERR "\033[1;31m" //Bright Red
+
/* Close the log. Currently a NOP. */
#define SYSLOG_ACTION_CLOSE 0
/* Open the log. Currently a NOP. */
@@ -147,7 +153,8 @@ struct dmesg_control {
notime:1, /* don't print timestamp */
delta:1, /* show time deltas */
reltime:1, /* show human readable relative times */
- ctime:1; /* show human readable time */
+ ctime:1, /* show human readable time */
+ color:1; /* colorize error and panic messages */
};
struct dmesg_record {
@@ -193,6 +200,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
" -f, --facility <list> restrict output to defined facilities\n"
" -h, --help display this help and exit\n"
" -k, --kernel display kernel messages\n"
+ " -L, --color colorize error and panic messages\n"
" -l, --level <list> restrict output to defined levels\n"
" -n, --console-level <level> set level of messages printed to console\n"
" -r, --raw print the raw message buffer\n"
@@ -839,8 +847,16 @@ static void print_record(struct dmesg_control *ctl,
printf("[%5d.%06d] ", (int) rec->tv.tv_sec, (int) rec->tv.tv_usec);
mesg:
+ //Change the output color for panic and error messages
+ if (ctl->color)
+ set_clr(rec->level == K_PANIC ? CLR_PANIC :
+ rec->level == K_ERR ? CLR_ERR : CLR_RST, stdout);
+
safe_fwrite(rec->mesg, rec->mesg_size, stdout);
+ if (ctl->color)
+ rst_clr(stdout);
+
if (*(rec->mesg + rec->mesg_size - 1) != '\n')
putchar('\n');
}
@@ -1046,6 +1062,7 @@ int main(int argc, char *argv[])
static const struct option longopts[] = {
{ "buffer-size", required_argument, NULL, 's' },
{ "clear", no_argument, NULL, 'C' },
+ { "color", no_argument, NULL, 'L' },
{ "console-level", required_argument, NULL, 'n' },
{ "console-off", no_argument, NULL, 'D' },
{ "console-on", no_argument, NULL, 'E' },
@@ -1080,7 +1097,7 @@ int main(int argc, char *argv[])
textdomain(PACKAGE);
atexit(close_stdout);
- while ((c = getopt_long(argc, argv, "CcDdEeF:f:hkl:n:rSs:TtuVwx",
+ while ((c = getopt_long(argc, argv, "CcDdEeF:f:hkLl:n:rSs:TtuVwx",
longopts, NULL)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
@@ -1123,6 +1140,9 @@ int main(int argc, char *argv[])
ctl.fltr_fac = 1;
setbit(ctl.facilities, FAC_BASE(LOG_KERN));
break;
+ case 'L':
+ ctl.color = 1;
+ break;
case 'l':
ctl.fltr_lev= 1;
if (string_to_bitarray(optarg,
@@ -1180,9 +1200,9 @@ int main(int argc, char *argv[])
usage(stderr);
if (ctl.raw && (ctl.fltr_lev || ctl.fltr_fac || ctl.delta ||
- ctl.notime || ctl.ctime || ctl.decode))
+ ctl.notime || ctl.ctime || ctl.decode || ctl.color))
errx(EXIT_FAILURE, _("--raw can't be used together with level, "
- "facility, decode, delta, ctime or notime options"));
+ "facility, decode, delta, ctime, notime or color options"));
if (ctl.notime && (ctl.ctime || ctl.reltime))
errx(EXIT_FAILURE, _("--notime can't be used together with --ctime or --reltime"));
--
1.7.11.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dmesg colorized output
2012-10-10 7:44 [PATCH] dmesg colorized output Ondrej Oprala
@ 2012-10-10 9:19 ` Karel Zak
2012-10-10 9:26 ` Davidlohr Bueso
0 siblings, 1 reply; 5+ messages in thread
From: Karel Zak @ 2012-10-10 9:19 UTC (permalink / raw)
To: Ondrej Oprala; +Cc: util-linux
On Wed, Oct 10, 2012 at 09:44:05AM +0200, Ondrej Oprala wrote:
> new file mode 100644
> index 0000000..90b62a7
> --- /dev/null
> +++ b/include/colors.h
> @@ -0,0 +1,19 @@
Please, see another files in include/.
#ifndef UTIL_LINUX_COLOR_H
#define UTIL_LINUX_COLOR_H
> +/*
> + * Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
> + *
> + * This file may be distributed under the terms of the
> + * GNU Lesser General Public License.
> + */
> +
> +#include <stdio.h>
> +#include <unistd.h>
> +#define CLR_RST "\033[0m"
#define UL_COLOR_RESET
to keep it readable. It would be also nice to have macros for
individual colors (UL_COLOR_{RED,YELLOW,BLUE,...} and extra modes like
bold.
(It's also possible to set background colors, but I guess that
foreground colors are enough for our utils.)
> --- /dev/null
> +++ b/lib/colors.c
> @@ -0,0 +1,20 @@
> +/*
> + * Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
> + *
> + * This file may be distributed under the terms of the
> + * GNU Lesser General Public License.
> + */
> +
> +#include "colors.h"
> +
> +void set_clr(const char *clr_scheme, FILE *out)
color_enable()
Is it necessary to care about "out"? Maybe we can assume that the
output is stdout.
> +{
> + if (isatty(fileno(out)))
> + fprintf(out, clr_scheme);
> +}
if I good remember than isatty() is internally implemented by any
ioctl(). It would be probably better to have something like:
int colors_init();
where we check all necessary terminal features and initialize a
global variable, so in color_enable/disable() we will check the
variable only.
> +void rst_clr(FILE *out)
color_disable()
Maybe for the functions names we should also use ul_ prefix to avoid
collisions (for example ncurses library also uses pretty generic names
for color functions).
> +{
> + if (isatty(fileno(out)))
> + fprintf(out, CLR_RST);
> +}
Please, use fputs() rather than fprintf().
> diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
> index 4c85f9f..fc384d7 100644
> --- a/sys-utils/dmesg.c
> +++ b/sys-utils/dmesg.c
> @@ -23,6 +23,7 @@
> #include <fcntl.h>
>
> #include "c.h"
> +#include "colors.h"
> #include "nls.h"
> #include "strutils.h"
> #include "xalloc.h"
> @@ -33,6 +34,11 @@
> #include "optutils.h"
> #include "mangle.h"
>
> +#define K_PANIC 1
> +#define K_ERR 3
really no, already defined by LOG_* macros in
<sys/syslog.h>, see also level_names[] array in dmesg.c.
> +#define CLR_PANIC "\033[31m" //Red
> +#define CLR_ERR "\033[1;31m" //Bright Red
#define DMESG_COLOR_ALERT UL_COLOR_RED
#define DMESG_COLOR_ERR UL_COLOR_BRIGHT_RED
> /* Close the log. Currently a NOP. */
> #define SYSLOG_ACTION_CLOSE 0
> /* Open the log. Currently a NOP. */
> @@ -147,7 +153,8 @@ struct dmesg_control {
> notime:1, /* don't print timestamp */
> delta:1, /* show time deltas */
> reltime:1, /* show human readable relative times */
> - ctime:1; /* show human readable time */
> + ctime:1, /* show human readable time */
> + color:1; /* colorize error and panic messages */
> };
>
> struct dmesg_record {
> @@ -193,6 +200,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
> " -f, --facility <list> restrict output to defined facilities\n"
> " -h, --help display this help and exit\n"
> " -k, --kernel display kernel messages\n"
> + " -L, --color colorize error and panic messages\n"
> " -l, --level <list> restrict output to defined levels\n"
> " -n, --console-level <level> set level of messages printed to console\n"
> " -r, --raw print the raw message buffer\n"
> @@ -839,8 +847,16 @@ static void print_record(struct dmesg_control *ctl,
> printf("[%5d.%06d] ", (int) rec->tv.tv_sec, (int) rec->tv.tv_usec);
>
> mesg:
> + //Change the output color for panic and error messages
> + if (ctl->color)
> + set_clr(rec->level == K_PANIC ? CLR_PANIC :
> + rec->level == K_ERR ? CLR_ERR : CLR_RST, stdout);
keep it elegant:
if (ctl->color)
set_level_color(rec->level);
:-)
> safe_fwrite(rec->mesg, rec->mesg_size, stdout);
>
> + if (ctl->color)
> + rst_clr(stdout);
> +
> if (*(rec->mesg + rec->mesg_size - 1) != '\n')
> putchar('\n');
> }
> @@ -1046,6 +1062,7 @@ int main(int argc, char *argv[])
> static const struct option longopts[] = {
> { "buffer-size", required_argument, NULL, 's' },
> { "clear", no_argument, NULL, 'C' },
> + { "color", no_argument, NULL, 'L' },
> { "console-level", required_argument, NULL, 'n' },
> { "console-off", no_argument, NULL, 'D' },
> { "console-on", no_argument, NULL, 'E' },
> @@ -1080,7 +1097,7 @@ int main(int argc, char *argv[])
> textdomain(PACKAGE);
> atexit(close_stdout);
>
> - while ((c = getopt_long(argc, argv, "CcDdEeF:f:hkl:n:rSs:TtuVwx",
> + while ((c = getopt_long(argc, argv, "CcDdEeF:f:hkLl:n:rSs:TtuVwx",
> longopts, NULL)) != -1) {
>
> err_exclusive_options(c, longopts, excl, excl_st);
> @@ -1123,6 +1140,9 @@ int main(int argc, char *argv[])
> ctl.fltr_fac = 1;
> setbit(ctl.facilities, FAC_BASE(LOG_KERN));
> break;
> + case 'L':
> + ctl.color = 1;
> + break;
> case 'l':
> ctl.fltr_lev= 1;
> if (string_to_bitarray(optarg,
> @@ -1180,9 +1200,9 @@ int main(int argc, char *argv[])
> usage(stderr);
>
> if (ctl.raw && (ctl.fltr_lev || ctl.fltr_fac || ctl.delta ||
> - ctl.notime || ctl.ctime || ctl.decode))
> + ctl.notime || ctl.ctime || ctl.decode || ctl.color))
> errx(EXIT_FAILURE, _("--raw can't be used together with level, "
> - "facility, decode, delta, ctime or notime options"));
> + "facility, decode, delta, ctime, notime or color options"));
if (ctl.color && ul_color_init() != 0)
ctl.color = 0;
Thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmesg colorized output
2012-10-10 9:19 ` Karel Zak
@ 2012-10-10 9:26 ` Davidlohr Bueso
2012-10-10 9:33 ` Karel Zak
0 siblings, 1 reply; 5+ messages in thread
From: Davidlohr Bueso @ 2012-10-10 9:26 UTC (permalink / raw)
To: Karel Zak; +Cc: Ondrej Oprala, util-linux
On Wed, 2012-10-10 at 11:19 +0200, Karel Zak wrote:
> On Wed, Oct 10, 2012 at 09:44:05AM +0200, Ondrej Oprala wrote:
> > new file mode 100644
Hehe I actually started doing this last night.
I'm wondering if we actually need a new lib file for colors. I mean
AFAICT, dmesg is the only place we want to use it and I don't see that
changing any time soon - Unix hackers don't like colors, we live oh so
boring lives :)
> > index 0000000..90b62a7
> > --- /dev/null
> > +++ b/include/colors.h
> > @@ -0,0 +1,19 @@
>
> Please, see another files in include/.
>
> #ifndef UTIL_LINUX_COLOR_H
> #define UTIL_LINUX_COLOR_H
>
> > +/*
> > + * Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
> > + *
> > + * This file may be distributed under the terms of the
> > + * GNU Lesser General Public License.
> > + */
> > +
> > +#include <stdio.h>
> > +#include <unistd.h>
> > +#define CLR_RST "\033[0m"
>
> #define UL_COLOR_RESET
>
> to keep it readable. It would be also nice to have macros for
> individual colors (UL_COLOR_{RED,YELLOW,BLUE,...} and extra modes like
> bold.
>
> (It's also possible to set background colors, but I guess that
> foreground colors are enough for our utils.)
>
> > --- /dev/null
> > +++ b/lib/colors.c
> > @@ -0,0 +1,20 @@
> > +/*
> > + * Copyright (C) 2012 Ondrej Oprala <ooprala@redhat.com>
> > + *
> > + * This file may be distributed under the terms of the
> > + * GNU Lesser General Public License.
> > + */
> > +
> > +#include "colors.h"
> > +
> > +void set_clr(const char *clr_scheme, FILE *out)
>
> color_enable()
>
> Is it necessary to care about "out"? Maybe we can assume that the
> output is stdout.
>
> > +{
> > + if (isatty(fileno(out)))
> > + fprintf(out, clr_scheme);
> > +}
>
> if I good remember than isatty() is internally implemented by any
> ioctl(). It would be probably better to have something like:
>
> int colors_init();
>
> where we check all necessary terminal features and initialize a
> global variable, so in color_enable/disable() we will check the
> variable only.
>
> > +void rst_clr(FILE *out)
>
> color_disable()
>
> Maybe for the functions names we should also use ul_ prefix to avoid
> collisions (for example ncurses library also uses pretty generic names
> for color functions).
>
> > +{
> > + if (isatty(fileno(out)))
> > + fprintf(out, CLR_RST);
> > +}
>
> Please, use fputs() rather than fprintf().
>
> > diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
> > index 4c85f9f..fc384d7 100644
> > --- a/sys-utils/dmesg.c
> > +++ b/sys-utils/dmesg.c
> > @@ -23,6 +23,7 @@
> > #include <fcntl.h>
> >
> > #include "c.h"
> > +#include "colors.h"
> > #include "nls.h"
> > #include "strutils.h"
> > #include "xalloc.h"
> > @@ -33,6 +34,11 @@
> > #include "optutils.h"
> > #include "mangle.h"
> >
> > +#define K_PANIC 1
> > +#define K_ERR 3
>
> really no, already defined by LOG_* macros in
> <sys/syslog.h>, see also level_names[] array in dmesg.c.
>
> > +#define CLR_PANIC "\033[31m" //Red
> > +#define CLR_ERR "\033[1;31m" //Bright Red
how about using /* ... */
>
> #define DMESG_COLOR_ALERT UL_COLOR_RED
> #define DMESG_COLOR_ERR UL_COLOR_BRIGHT_RED
>
>
> > /* Close the log. Currently a NOP. */
> > #define SYSLOG_ACTION_CLOSE 0
> > /* Open the log. Currently a NOP. */
> > @@ -147,7 +153,8 @@ struct dmesg_control {
> > notime:1, /* don't print timestamp */
> > delta:1, /* show time deltas */
> > reltime:1, /* show human readable relative times */
> > - ctime:1; /* show human readable time */
> > + ctime:1, /* show human readable time */
> > + color:1; /* colorize error and panic messages */
> > };
> >
> > struct dmesg_record {
> > @@ -193,6 +200,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
> > " -f, --facility <list> restrict output to defined facilities\n"
> > " -h, --help display this help and exit\n"
> > " -k, --kernel display kernel messages\n"
> > + " -L, --color colorize error and panic messages\n"
> > " -l, --level <list> restrict output to defined levels\n"
> > " -n, --console-level <level> set level of messages printed to console\n"
> > " -r, --raw print the raw message buffer\n"
> > @@ -839,8 +847,16 @@ static void print_record(struct dmesg_control *ctl,
> > printf("[%5d.%06d] ", (int) rec->tv.tv_sec, (int) rec->tv.tv_usec);
> >
> > mesg:
> > + //Change the output color for panic and error messages
> > + if (ctl->color)
> > + set_clr(rec->level == K_PANIC ? CLR_PANIC :
> > + rec->level == K_ERR ? CLR_ERR : CLR_RST, stdout);
>
> keep it elegant:
>
> if (ctl->color)
> set_level_color(rec->level);
>
> :-)
>
> > safe_fwrite(rec->mesg, rec->mesg_size, stdout);
> >
> > + if (ctl->color)
> > + rst_clr(stdout);
> > +
> > if (*(rec->mesg + rec->mesg_size - 1) != '\n')
> > putchar('\n');
> > }
> > @@ -1046,6 +1062,7 @@ int main(int argc, char *argv[])
> > static const struct option longopts[] = {
> > { "buffer-size", required_argument, NULL, 's' },
> > { "clear", no_argument, NULL, 'C' },
> > + { "color", no_argument, NULL, 'L' },
> > { "console-level", required_argument, NULL, 'n' },
> > { "console-off", no_argument, NULL, 'D' },
> > { "console-on", no_argument, NULL, 'E' },
> > @@ -1080,7 +1097,7 @@ int main(int argc, char *argv[])
> > textdomain(PACKAGE);
> > atexit(close_stdout);
> >
> > - while ((c = getopt_long(argc, argv, "CcDdEeF:f:hkl:n:rSs:TtuVwx",
> > + while ((c = getopt_long(argc, argv, "CcDdEeF:f:hkLl:n:rSs:TtuVwx",
> > longopts, NULL)) != -1) {
> >
> > err_exclusive_options(c, longopts, excl, excl_st);
> > @@ -1123,6 +1140,9 @@ int main(int argc, char *argv[])
> > ctl.fltr_fac = 1;
> > setbit(ctl.facilities, FAC_BASE(LOG_KERN));
> > break;
> > + case 'L':
> > + ctl.color = 1;
> > + break;
> > case 'l':
> > ctl.fltr_lev= 1;
> > if (string_to_bitarray(optarg,
> > @@ -1180,9 +1200,9 @@ int main(int argc, char *argv[])
> > usage(stderr);
> >
> > if (ctl.raw && (ctl.fltr_lev || ctl.fltr_fac || ctl.delta ||
> > - ctl.notime || ctl.ctime || ctl.decode))
> > + ctl.notime || ctl.ctime || ctl.decode || ctl.color))
> > errx(EXIT_FAILURE, _("--raw can't be used together with level, "
> > - "facility, decode, delta, ctime or notime options"));
> > + "facility, decode, delta, ctime, notime or color options"));
>
> if (ctl.color && ul_color_init() != 0)
> ctl.color = 0;
>
> Thanks!
>
> Karel
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmesg colorized output
2012-10-10 9:26 ` Davidlohr Bueso
@ 2012-10-10 9:33 ` Karel Zak
2012-10-10 12:09 ` Petr Uzel
0 siblings, 1 reply; 5+ messages in thread
From: Karel Zak @ 2012-10-10 9:33 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: Ondrej Oprala, util-linux
On Wed, Oct 10, 2012 at 11:26:09AM +0200, Davidlohr Bueso wrote:
> On Wed, 2012-10-10 at 11:19 +0200, Karel Zak wrote:
> > On Wed, Oct 10, 2012 at 09:44:05AM +0200, Ondrej Oprala wrote:
> > > new file mode 100644
>
> Hehe I actually started doing this last night.
>
> I'm wondering if we actually need a new lib file for colors. I mean
> AFAICT, dmesg is the only place we want to use it and I don't see that
What about fdisk where we have many dialogs, warnings, hints? :-) It's
not about colors only, but also about bold, etc.
The another possibility is namei(1) where we can provide output
compatible with ls(1), or cal(1), etc.
> changing any time soon - Unix hackers don't like colors, we live oh so
> boring lives :)
All this should be optional. I guess than many people use aliases with
colors
$ alias | grep color
alias egrep='egrep --color=tty'
alias fgrep='fgrep --color=tty'
alias grep='grep --color=tty'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dmesg colorized output
2012-10-10 9:33 ` Karel Zak
@ 2012-10-10 12:09 ` Petr Uzel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Uzel @ 2012-10-10 12:09 UTC (permalink / raw)
To: util-linux
[-- Attachment #1: Type: text/plain, Size: 1340 bytes --]
On Wed, Oct 10, 2012 at 11:33:34AM +0200, Karel Zak wrote:
> On Wed, Oct 10, 2012 at 11:26:09AM +0200, Davidlohr Bueso wrote:
> > On Wed, 2012-10-10 at 11:19 +0200, Karel Zak wrote:
> > > On Wed, Oct 10, 2012 at 09:44:05AM +0200, Ondrej Oprala wrote:
> > > > new file mode 100644
> >
> > Hehe I actually started doing this last night.
> >
> > I'm wondering if we actually need a new lib file for colors. I mean
> > AFAICT, dmesg is the only place we want to use it and I don't see that
>
> What about fdisk where we have many dialogs, warnings, hints? :-) It's
> not about colors only, but also about bold, etc.
>
> The another possibility is namei(1) where we can provide output
> compatible with ls(1), or cal(1), etc.
>
> > changing any time soon - Unix hackers don't like colors, we live oh so
> > boring lives :)
>
> All this should be optional. I guess than many people use aliases with
> colors
>
> $ alias | grep color
> alias egrep='egrep --color=tty'
> alias fgrep='fgrep --color=tty'
> alias grep='grep --color=tty'
> alias l.='ls -d .* --color=auto'
> alias ll='ls -l --color=auto'
> alias ls='ls --color=auto'
I totally agree. Colored output from various tools could make it
easier to work with, but it has to be optional.
My 2c.
Petr
--
Petr Uzel
IRC: ptr_uzl @ freenode
[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-10 12:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-10 7:44 [PATCH] dmesg colorized output Ondrej Oprala
2012-10-10 9:19 ` Karel Zak
2012-10-10 9:26 ` Davidlohr Bueso
2012-10-10 9:33 ` Karel Zak
2012-10-10 12:09 ` Petr Uzel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.