diff options
author | Karel Zak | 2014-08-13 10:10:11 +0200 |
---|---|---|
committer | Karel Zak | 2014-08-13 10:10:11 +0200 |
commit | d44115f3b5866f76ceaefd0d145468e68d7e2688 (patch) | |
tree | d7d83433edd97bbefaf9539c10f95b42937b4145 /disk-utils/cfdisk.c | |
parent | lib/colors: add function to return color from scheme (diff) | |
download | kernel-qcow2-util-linux-d44115f3b5866f76ceaefd0d145468e68d7e2688.tar.gz kernel-qcow2-util-linux-d44115f3b5866f76ceaefd0d145468e68d7e2688.tar.xz kernel-qcow2-util-linux-d44115f3b5866f76ceaefd0d145468e68d7e2688.zip |
libfdisk: remove dependence on libsmartcols
It's application business to convert libfdisk_table to string.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/cfdisk.c')
-rw-r--r-- | disk-utils/cfdisk.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index eff793355..453eafab0 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -235,9 +235,6 @@ static int partition_from_scols(struct fdisk_table *tb, return 0; } -/* It would be possible to use fdisk_table_to_string(), but we want some - * extension to the output format, so let's do it without libfdisk - */ static char *table_to_string(struct cfdisk *cf, struct fdisk_table *tb) { const struct fdisk_column *col; @@ -283,10 +280,18 @@ static char *table_to_string(struct cfdisk *cf, struct fdisk_table *tb) for (i = 0; i < cf->ncols; i++) { col = fdisk_label_get_column(lb, cf->cols[i]); if (col) { - int fl = col->scols_flags; - if (tree && col->id == FDISK_COL_DEVICE) + int fl = 0; + + if (fdisk_column_is_number(col)) + fl |= SCOLS_FL_RIGHT; + if (fdisk_column_get_id(col) == FDISK_COL_TYPE) + fl |= SCOLS_FL_TRUNC; + if (tree && fdisk_column_get_id(col) == FDISK_COL_DEVICE) fl |= SCOLS_FL_TREE; - if (!scols_table_new_column(table, col->name, col->width, fl)) + + if (!scols_table_new_column(table, + fdisk_column_get_name(col), + fdisk_column_get_width(col), fl)) goto done; } } @@ -305,7 +310,8 @@ static char *table_to_string(struct cfdisk *cf, struct fdisk_table *tb) col = fdisk_label_get_column(lb, cf->cols[i]); if (!col) continue; - if (fdisk_partition_to_string(pa, cf->cxt, col->id, &cdata)) + if (fdisk_partition_to_string(pa, cf->cxt, + fdisk_column_get_id(col), &cdata)) continue; scols_line_refer_data(ln, i, cdata); } |