diff options
author | Karel Zak | 2013-05-07 09:09:35 +0200 |
---|---|---|
committer | Karel Zak | 2013-05-07 09:09:35 +0200 |
commit | b7faf99128c6dd5c01e58de6227fd5ab42f5602c (patch) | |
tree | 54a549da474953e93d3ec66148b0653b3494edb4 /sys-utils | |
parent | prlimit: delete rem_prlim prototype (diff) | |
download | kernel-qcow2-util-linux-b7faf99128c6dd5c01e58de6227fd5ab42f5602c.tar.gz kernel-qcow2-util-linux-b7faf99128c6dd5c01e58de6227fd5ab42f5602c.tar.xz kernel-qcow2-util-linux-b7faf99128c6dd5c01e58de6227fd5ab42f5602c.zip |
lib/colors: add colormode_or_err()
... to make the code easy to use in utils.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/dmesg.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index 5d0453300..ae8e93807 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -1241,12 +1241,9 @@ int main(int argc, char *argv[]) break; case 'L': colormode = UL_COLORMODE_AUTO; - if (optarg) { - char *p = *optarg == '=' ? optarg + 1 : optarg; - colormode = colormode_from_string(p); - if (colormode < 0) - errx(EXIT_FAILURE, _("unsupported color mode: '%s'"), p); - } + if (optarg) + colormode = colormode_or_err(optarg, + _("unsupported color mode")); break; case 'l': ctl.fltr_lev= 1; |