diff options
author | Ondrej Oprala | 2014-03-24 13:40:05 +0100 |
---|---|---|
committer | Karel Zak | 2014-04-03 12:29:17 +0200 |
commit | 35958d0c61cff969506a4ab1a15e1e28c7a60f77 (patch) | |
tree | 0646510949b0b4f4a3b058a2092f39ae18a812a7 /libsmartcols/src/column.c | |
parent | libsmartcols: separate flags, add getters/setters (diff) | |
download | kernel-qcow2-util-linux-35958d0c61cff969506a4ab1a15e1e28c7a60f77.tar.gz kernel-qcow2-util-linux-35958d0c61cff969506a4ab1a15e1e28c7a60f77.tar.xz kernel-qcow2-util-linux-35958d0c61cff969506a4ab1a15e1e28c7a60f77.zip |
libsmartcols: colors may now be specified as human-readable strings
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Diffstat (limited to 'libsmartcols/src/column.c')
-rw-r--r-- | libsmartcols/src/column.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c index 5fad5319f..29eb63666 100644 --- a/libsmartcols/src/column.c +++ b/libsmartcols/src/column.c @@ -12,6 +12,7 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <ctype.h> #include "smartcolsP.h" @@ -118,6 +119,12 @@ int scols_column_set_color(struct libscols_column *cl, const char *color) if (!cl) return -EINVAL; if (color) { + if (isalnum(*color)) { + color = colorscheme_from_string(color); + + if (!color) + return -EINVAL; + } p = strdup(color); if (!p) return -ENOMEM; |