summaryrefslogtreecommitdiffstats
path: root/text-utils/column.c
diff options
context:
space:
mode:
authorKarel Zak2017-04-11 13:48:02 +0200
committerKarel Zak2017-05-02 12:18:00 +0200
commitbd6b5a6498d7a33983cde032a42186fa1e534d0d (patch)
tree580c61a40fe63c0d003820c658120e3563b1b315 /text-utils/column.c
parentcolumns: add note about width (diff)
downloadkernel-qcow2-util-linux-bd6b5a6498d7a33983cde032a42186fa1e534d0d.tar.gz
kernel-qcow2-util-linux-bd6b5a6498d7a33983cde032a42186fa1e534d0d.tar.xz
kernel-qcow2-util-linux-bd6b5a6498d7a33983cde032a42186fa1e534d0d.zip
column: force to follow specified width
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'text-utils/column.c')
-rw-r--r--text-utils/column.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/text-utils/column.c b/text-utils/column.c
index 3b582ca1d..c22de90ce 100644
--- a/text-utils/column.c
+++ b/text-utils/column.c
@@ -341,6 +341,7 @@ static void create_tree(struct column_control *ctl)
static void modify_table(struct column_control *ctl)
{
scols_table_set_termwidth(ctl->tab, ctl->termwidth);
+ scols_table_set_termforce(ctl->tab, SCOLS_TERMFORCE_ALWAYS);
if (ctl->tab_colright)
apply_columnflag_from_list(ctl, ctl->tab_colright,
@@ -578,7 +579,8 @@ int main(int argc, char **argv)
{
struct column_control ctl = {
.mode = COLUMN_MODE_FILLCOLS,
- .greedy = 1
+ .greedy = 1,
+ .termwidth = (size_t) -1
};
int c;
@@ -620,7 +622,6 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
atexit(close_stdout);
- ctl.termwidth = get_terminal_width(80);
ctl.output_separator = " ";
ctl.input_separator = mbs_to_wcs("\t ");
@@ -696,6 +697,9 @@ int main(int argc, char **argv)
argc -= optind;
argv += optind;
+ if (ctl.termwidth == (size_t) -1)
+ ctl.termwidth = get_terminal_width(80);
+
if (ctl.tree) {
ctl.mode = COLUMN_MODE_TABLE;
if (!ctl.tree_parent || !ctl.tree_id)