]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: use new colors API
authorKarel Zak <kzak@redhat.com>
Mon, 5 May 2014 14:32:14 +0000 (16:32 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 13 May 2014 10:09:03 +0000 (12:09 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libsmartcols/src/cell.c
libsmartcols/src/column.c
libsmartcols/src/line.c

index 491b8a15c0d62a5a4de35b2059b640788385f0cf..d73a1f80868e9b30495f94ff0a9d8d33f14023cf 100644 (file)
@@ -117,7 +117,7 @@ const char *scols_cell_get_data(const struct libscols_cell *ce)
 /**
  * scols_cell_set_color:
  * @ce: a pointer to a struct libscols_cell instance
- * @color: a color string
+ * @color: color name or ESC sequence
  *
  * Set the color of @ce to @color.
  *
@@ -132,8 +132,8 @@ int scols_cell_set_color(struct libscols_cell *ce, const char *color)
        if (!ce)
                return -EINVAL;
        if (color) {
-               if (isalnum(*color)) {
-                       color = colorscheme_from_string(color);
+               if (isalpha(*color)) {
+                       color = color_sequence_from_colorname(color);
 
                        if (!color)
                                return -EINVAL;
index 4ee782fb2485241edaaba13baaad40512ceb9699..a8f117f85c8a888826348a4338c033c22bfa5026 100644 (file)
@@ -190,7 +190,7 @@ struct libscols_cell *scols_column_get_header(struct libscols_column *cl)
 /**
  * scols_column_set_color:
  * @cl: a pointer to a struct libscols_column instance
- * @color: a color string
+ * @color: color name or ESC sequence
  *
  * The default color for data cells and column header.
  *
@@ -210,8 +210,8 @@ 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 (isalpha(*color)) {
+                       color = color_sequence_from_colorname(color);
 
                        if (!color)
                                return -EINVAL;
index 686a1194547a739362547043525307e1fa03c608..32c8964ad69b4e0ba1f2442588c98d54931c66a3 100644 (file)
@@ -285,7 +285,7 @@ int scols_line_next_child(struct libscols_line *ln,
 /**
  * scols_line_set_color:
  * @ln: a pointer to a struct libscols_line instance
- * @color: a color string
+ * @color: color name or ESC sequence
  *
  * Returns: 0, a negative value in case of an error.
  */
@@ -298,7 +298,7 @@ int scols_line_set_color(struct libscols_line *ln, const char *color)
                return -EINVAL;
        if (color) {
                if (isalnum(*color)) {
-                       color = colorscheme_from_string(color);
+                       color = color_sequence_from_colorname(color);
 
                        if (!color)
                                return -EINVAL;