summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--disk-utils/cfdisk.c2
-rw-r--r--disk-utils/partx.c1
-rw-r--r--libsmartcols/src/cell.c3
-rw-r--r--libsmartcols/src/column.c7
-rw-r--r--libsmartcols/src/line.c15
-rw-r--r--libsmartcols/src/smartcolsP.h5
-rw-r--r--libsmartcols/src/table.c30
-rw-r--r--libsmartcols/src/table_print.c83
-rw-r--r--login-utils/lslogins.c2
-rw-r--r--misc-utils/findmnt.c1
-rw-r--r--misc-utils/lsblk.c1
-rw-r--r--misc-utils/lslocks.c2
-rw-r--r--sys-utils/losetup.c2
-rw-r--r--sys-utils/lscpu.c5
-rw-r--r--sys-utils/prlimit.c2
-rw-r--r--sys-utils/swapon.c2
-rw-r--r--sys-utils/wdctl.c2
17 files changed, 145 insertions, 20 deletions
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
index b0185092a..bf49cf257 100644
--- a/disk-utils/cfdisk.c
+++ b/disk-utils/cfdisk.c
@@ -1981,6 +1981,8 @@ int main(int argc, char *argv[])
colors_init(colormode, "cfdisk");
fdisk_init_debug(0);
+ scols_init_debug(0);
+
cf->cxt = fdisk_new_context();
if (!cf->cxt)
err(EXIT_FAILURE, _("failed to allocate libfdisk context"));
diff --git a/disk-utils/partx.c b/disk-utils/partx.c
index 830af1f32..bf5a4abf7 100644
--- a/disk-utils/partx.c
+++ b/disk-utils/partx.c
@@ -626,6 +626,7 @@ static int show_parts(blkid_partlist ls, int scols_flags, int lower, int upper)
if (!nparts)
return 0;
+ scols_init_debug(0);
table = scols_new_table();
if (!table) {
warn(_("failed to initialize output table"));
diff --git a/libsmartcols/src/cell.c b/libsmartcols/src/cell.c
index 2cc93c296..c05ceb812 100644
--- a/libsmartcols/src/cell.c
+++ b/libsmartcols/src/cell.c
@@ -46,6 +46,7 @@ int scols_reset_cell(struct libscols_cell *ce)
if (!ce)
return -EINVAL;
+ /*DBG(CELL, ul_debugobj(ce, "reset"));*/
free(ce->data);
free(ce->color);
memset(ce, 0, sizeof(*ce));
@@ -241,5 +242,7 @@ int scols_cell_copy_content(struct libscols_cell *dest,
rc = scols_cell_set_color(dest, scols_cell_get_color(src));
if (!rc)
dest->userdata = src->userdata;
+
+ DBG(CELL, ul_debugobj((void *) src, "copy into %p", dest));
return rc;
}
diff --git a/libsmartcols/src/column.c b/libsmartcols/src/column.c
index 130a729e2..7ba284c6e 100644
--- a/libsmartcols/src/column.c
+++ b/libsmartcols/src/column.c
@@ -38,7 +38,7 @@ struct libscols_column *scols_new_column(void)
cl = calloc(1, sizeof(*cl));
if (!cl)
return NULL;
-
+ DBG(COL, ul_debugobj(cl, "alloc"));
cl->refcount = 1;
INIT_LIST_HEAD(&cl->cl_columns);
return cl;
@@ -65,6 +65,7 @@ void scols_ref_column(struct libscols_column *cl)
void scols_unref_column(struct libscols_column *cl)
{
if (cl && --cl->refcount <= 0) {
+ DBG(COL, ul_debugobj(cl, "dealloc"));
list_del(&cl->cl_columns);
scols_reset_cell(&cl->header);
free(cl->color);
@@ -76,7 +77,7 @@ void scols_unref_column(struct libscols_column *cl)
* scols_copy_column:
* @cl: a pointer to a struct libscols_column instance
*
- * Creates a new column and copies @cl's data over to it.
+ * Creates a new column and copies @cl's data over to it.
*
* Returns: a pointer to a new struct libscols_column instance.
*/
@@ -91,6 +92,8 @@ struct libscols_column *scols_copy_column(const struct libscols_column *cl)
if (!ret)
return NULL;
+ DBG(COL, ul_debugobj((void *) cl, "copy to %p", ret));
+
if (scols_column_set_color(ret, cl->color))
goto err;
if (scols_cell_copy_content(&ret->header, &cl->header))
diff --git a/libsmartcols/src/line.c b/libsmartcols/src/line.c
index 611209081..0ed765dcd 100644
--- a/libsmartcols/src/line.c
+++ b/libsmartcols/src/line.c
@@ -41,6 +41,8 @@ struct libscols_line *scols_new_line(void)
ln = calloc(1, sizeof(*ln));
if (!ln)
return NULL;
+
+ DBG(LINE, ul_debugobj(ln, "alloc"));
ln->refcount = 1;
INIT_LIST_HEAD(&ln->ln_lines);
INIT_LIST_HEAD(&ln->ln_children);
@@ -70,9 +72,9 @@ void scols_unref_line(struct libscols_line *ln)
{
if (ln && --ln->refcount <= 0) {
+ DBG(CELL, ul_debugobj(ln, "dealloc"));
list_del(&ln->ln_lines);
list_del(&ln->ln_children);
-
scols_line_free_cells(ln);
free(ln->color);
free(ln);
@@ -93,6 +95,8 @@ void scols_line_free_cells(struct libscols_line *ln)
if (!ln || !ln->cells)
return;
+ DBG(LINE, ul_debugobj(ln, "free cells"));
+
for (i = 0; i < ln->ncells; i++)
scols_reset_cell(&ln->cells[i]);
@@ -129,6 +133,8 @@ int scols_line_alloc_cells(struct libscols_line *ln, size_t n)
return 0;
}
+ DBG(LINE, ul_debugobj(ln, "alloc %zu cells", n));
+
ce = realloc(ln->cells, n * sizeof(struct libscols_cell));
if (!ce)
return -errno;
@@ -188,6 +194,9 @@ int scols_line_remove_child(struct libscols_line *ln, struct libscols_line *chil
if (!ln || !child)
return -EINVAL;
+
+ DBG(LINE, ul_debugobj(ln, "remove child %p", child));
+
list_del_init(&child->ln_children);
scols_unref_line(child);
@@ -217,6 +226,8 @@ int scols_line_add_child(struct libscols_line *ln, struct libscols_line *child)
if (child->parent)
scols_line_remove_child(child->parent, child);
+ DBG(LINE, ul_debugobj(ln, "add child %p", child));
+
/* new reference from parent to child */
list_add_tail(&child->ln_children, &ln->ln_branch);
scols_ref_line(child);
@@ -434,6 +445,8 @@ struct libscols_line *scols_copy_line(struct libscols_line *ln)
ret->ncells = ln->ncells;
ret->seqnum = ln->seqnum;
+ DBG(LINE, ul_debugobj(ln, "copy to %p", ret));
+
for (i = 0; i < ret->ncells; ++i) {
if (scols_cell_copy_content(&ret->cells[i], &ln->cells[i]))
goto err;
diff --git a/libsmartcols/src/smartcolsP.h b/libsmartcols/src/smartcolsP.h
index 613ddd587..28246c14f 100644
--- a/libsmartcols/src/smartcolsP.h
+++ b/libsmartcols/src/smartcolsP.h
@@ -31,6 +31,11 @@
* Debug
*/
#define SCOLS_DEBUG_INIT (1 << 1)
+#define SCOLS_DEBUG_CELL (1 << 2)
+#define SCOLS_DEBUG_LINE (1 << 3)
+#define SCOLS_DEBUG_TAB (1 << 4)
+#define SCOLS_DEBUG_COL (1 << 5)
+#define SCOLS_DEBUG_BUFF (1 << 6)
#define SCOLS_DEBUG_ALL 0xFFFF
UL_DEBUG_DECLARE_MASK(libsmartcols);
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index a51a84abc..53590038a 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -57,6 +57,7 @@ struct libscols_table *scols_new_table(void)
INIT_LIST_HEAD(&tb->tb_lines);
INIT_LIST_HEAD(&tb->tb_columns);
+ DBG(TAB, ul_debugobj(tb, "alloc"));
return tb;
}
@@ -81,6 +82,7 @@ void scols_ref_table(struct libscols_table *tb)
void scols_unref_table(struct libscols_table *tb)
{
if (tb && (--tb->refcount <= 0)) {
+ DBG(TAB, ul_debugobj(tb, "dealloc"));
scols_table_remove_lines(tb);
scols_table_remove_columns(tb);
scols_unref_symbols(tb->symbols);
@@ -110,6 +112,7 @@ int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl
if (cl->flags & SCOLS_FL_TREE)
tb->ntreecols++;
+ DBG(TAB, ul_debugobj(tb, "add column %p", cl));
list_add_tail(&cl->cl_columns, &tb->tb_columns);
cl->seqnum = tb->ncols++;
scols_ref_column(cl);
@@ -144,6 +147,7 @@ int scols_table_remove_column(struct libscols_table *tb,
if (cl->flags & SCOLS_FL_TREE)
tb->ntreecols--;
+ DBG(TAB, ul_debugobj(tb, "remove column %p", cl));
list_del_init(&cl->cl_columns);
tb->ncols--;
scols_unref_column(cl);
@@ -165,6 +169,7 @@ int scols_table_remove_columns(struct libscols_table *tb)
if (!tb || !list_empty(&tb->tb_lines))
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "remove all columns"));
while (!list_empty(&tb->tb_columns)) {
struct libscols_column *cl = list_entry(tb->tb_columns.next,
struct libscols_column, cl_columns);
@@ -219,6 +224,9 @@ struct libscols_column *scols_table_new_column(struct libscols_table *tb,
assert (tb);
if (!tb)
return NULL;
+
+ DBG(TAB, ul_debugobj(tb, "new column name=%s, whint=%g, flags=%d",
+ name, whint, flags));
cl = scols_new_column();
if (!cl)
return NULL;
@@ -313,6 +321,7 @@ int scols_table_set_stream(struct libscols_table *tb, FILE *stream)
if (!tb)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "setting alternative stream"));
tb->out = stream;
return 0;
}
@@ -346,6 +355,7 @@ int scols_table_reduce_termwidth(struct libscols_table *tb, size_t reduce)
if (!tb)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "reduce terminal width: %zu", reduce));
tb->termreduce = reduce;
return 0;
}
@@ -402,6 +412,7 @@ int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln)
return rc;
}
+ DBG(TAB, ul_debugobj(tb, "add line %p", ln));
list_add_tail(&ln->ln_lines, &tb->tb_lines);
ln->seqnum = tb->nlines++;
scols_ref_line(ln);
@@ -427,6 +438,7 @@ int scols_table_remove_line(struct libscols_table *tb,
if (!tb || !ln)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "remove line %p", ln));
list_del_init(&ln->ln_lines);
tb->nlines--;
scols_unref_line(ln);
@@ -445,6 +457,7 @@ void scols_table_remove_lines(struct libscols_table *tb)
if (!tb)
return;
+ DBG(TAB, ul_debugobj(tb, "remove all lines"));
while (!list_empty(&tb->tb_lines)) {
struct libscols_line *ln = list_entry(tb->tb_lines.next,
struct libscols_line, ln_lines);
@@ -508,6 +521,7 @@ struct libscols_line *scols_table_new_line(struct libscols_table *tb,
if (!tb || !tb->ncols)
return NULL;
+
ln = scols_new_line();
if (!ln)
return NULL;
@@ -580,6 +594,8 @@ struct libscols_table *scols_copy_table(struct libscols_table *tb)
if (!ret)
return NULL;
+ DBG(TAB, ul_debugobj(tb, "copy into %p", ret));
+
if (tb->symbols)
scols_table_set_symbols(ret, tb->symbols);
@@ -642,6 +658,8 @@ int scols_table_set_symbols(struct libscols_table *tb,
if (!tb)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "setting alternative symbols %p", sy));
+
if (tb->symbols) /* unref old */
scols_unref_symbols(tb->symbols);
if (sy) { /* ref user defined */
@@ -682,6 +700,8 @@ int scols_table_enable_colors(struct libscols_table *tb, int enable)
assert(tb);
if (!tb)
return -EINVAL;
+
+ DBG(TAB, ul_debugobj(tb, "colors: %s", enable ? "ENABLE" : "DISABLE"));
tb->colors_wanted = enable;
return 0;
}
@@ -701,6 +721,7 @@ int scols_table_enable_raw(struct libscols_table *tb, int enable)
if (!tb)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "raw: %s", enable ? "ENABLE" : "DISABLE"));
if (enable)
tb->format = SCOLS_FMT_RAW;
else if (tb->format == SCOLS_FMT_RAW)
@@ -723,6 +744,8 @@ int scols_table_enable_export(struct libscols_table *tb, int enable)
assert(tb);
if (!tb)
return -EINVAL;
+
+ DBG(TAB, ul_debugobj(tb, "export: %s", enable ? "ENABLE" : "DISABLE"));
if (enable)
tb->format = SCOLS_FMT_EXPORT;
else if (tb->format == SCOLS_FMT_EXPORT)
@@ -750,6 +773,8 @@ int scols_table_enable_ascii(struct libscols_table *tb, int enable)
assert(tb);
if (!tb)
return -EINVAL;
+
+ DBG(TAB, ul_debugobj(tb, "ascii: %s", enable ? "ENABLE" : "DISABLE"));
tb->ascii = enable ? 1 : 0;
return 0;
}
@@ -768,6 +793,7 @@ int scols_table_enable_noheadings(struct libscols_table *tb, int enable)
assert(tb);
if (!tb)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "noheading: %s", enable ? "ENABLE" : "DISABLE"));
tb->no_headings = enable ? 1 : 0;
return 0;
}
@@ -787,6 +813,7 @@ int scols_table_enable_maxout(struct libscols_table *tb, int enable)
assert(tb);
if (!tb)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "maxout: %s", enable ? "ENABLE" : "DISABLE"));
tb->maxout = enable ? 1 : 0;
return 0;
}
@@ -913,6 +940,7 @@ int scols_table_set_column_separator(struct libscols_table *tb, const char *sep)
return -ENOMEM;
}
+ DBG(TAB, ul_debugobj(tb, "new columns separator: %s", sep));
free(tb->colsep);
tb->colsep = p;
return 0;
@@ -942,6 +970,7 @@ int scols_table_set_line_separator(struct libscols_table *tb, const char *sep)
return -ENOMEM;
}
+ DBG(TAB, ul_debugobj(tb, "new lines separator: %s", sep));
free(tb->linesep);
tb->linesep = p;
return 0;
@@ -1013,6 +1042,7 @@ int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl)
if (!tb || !cl)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "sorting table"));
list_sort(&tb->tb_lines, cells_cmp_wrapper, cl);
return 0;
}
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c
index 24b73f942..c9f3d8f4b 100644
--- a/libsmartcols/src/table_print.c
+++ b/libsmartcols/src/table_print.c
@@ -48,11 +48,16 @@ static struct libscols_buffer *new_buffer(size_t sz)
buf->cur = buf->begin = ((char *) buf) + sizeof(struct libscols_buffer);
buf->encdata = NULL;
buf->bufsz = sz;
+
+ DBG(BUFF, ul_debugobj(buf, "alloc (size=%zu)", sz));
return buf;
}
static void free_buffer(struct libscols_buffer *buf)
{
+ if (!buf)
+ return;
+ DBG(BUFF, ul_debugobj(buf, "dealloc"));
free(buf->encdata);
free(buf);
}
@@ -62,6 +67,7 @@ static int buffer_reset_data(struct libscols_buffer *buf)
if (!buf)
return -EINVAL;
+ /*DBG(BUFF, ul_debugobj(buf, "reset data"));*/
buf->begin[0] = '\0';
buf->cur = buf->begin;
buf->art_idx = 0;
@@ -97,8 +103,10 @@ static int buffer_set_data(struct libscols_buffer *buf, const char *str)
/* save the current buffer possition to art_idx */
static void buffer_set_art_index(struct libscols_buffer *buf)
{
- if (buf)
+ if (buf) {
buf->art_idx = buf->cur - buf->begin;
+ /*DBG(BUFF, ul_debugobj(buf, "art index: %zu", buf->art_idx));*/
+ }
}
static char *buffer_get_data(struct libscols_buffer *buf)
@@ -162,6 +170,10 @@ static int print_data(struct libscols_table *tb,
assert(tb);
assert(cl);
+ DBG(TAB, ul_debugobj(tb,
+ " -> data, column=%p, line=%p, cell=%p, buff=%p",
+ cl, ln, ce, buf));
+
data = buffer_get_data(buf);
if (!data)
data = "";
@@ -340,6 +352,8 @@ static int print_line(struct libscols_table *tb,
assert(ln);
+ DBG(TAB, ul_debugobj(tb, "printing line, line=%p, buff=%p", ln, buf));
+
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (rc == 0 && scols_table_next_column(tb, &itr, &cl) == 0) {
rc = cell_to_buffer(tb, ln, cl, buf);
@@ -367,6 +381,8 @@ static int print_header(struct libscols_table *tb, struct libscols_buffer *buf)
list_empty(&tb->tb_lines))
return 0;
+ DBG(TAB, ul_debugobj(tb, "printing header"));
+
/* set width according to the size of data
*/
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
@@ -431,6 +447,8 @@ static int print_tree(struct libscols_table *tb, struct libscols_buffer *buf)
assert(tb);
+ DBG(TAB, ul_debugobj(tb, "printing tree"));
+
rc = print_header(tb, buf);
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
@@ -443,6 +461,31 @@ static int print_tree(struct libscols_table *tb, struct libscols_buffer *buf)
return rc;
}
+static void dbg_column(struct libscols_table *tb, struct libscols_column *cl)
+{
+ DBG(COL, ul_debugobj(cl, "%15s seq=%zu, width=%zd, "
+ "hint=%d, avg=%zu, max=%zu, min=%zu, "
+ "extreme=%s",
+
+ cl->header.data, cl->seqnum, cl->width,
+ cl->width_hint > 1 ? (int) cl->width_hint :
+ (int) (cl->width_hint * tb->termwidth),
+ cl->width_avg,
+ cl->width_max,
+ cl->width_min,
+ cl->is_extreme ? "yes" : "not"));
+}
+
+static void dbg_columns(struct libscols_table *tb)
+{
+ struct libscols_iter itr;
+ struct libscols_column *cl;
+
+ scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
+ while (scols_table_next_column(tb, &itr, &cl) == 0)
+ dbg_column(tb, cl);
+}
+
/*
* This function counts column width.
*
@@ -514,9 +557,11 @@ static int count_column_width(struct libscols_table *tb,
cl->width = (size_t) cl->width_hint;
+ ON_DBG(COL, dbg_column(tb, cl));
return rc;
}
+
/*
* This is core of the scols_* voodo...
*/
@@ -528,6 +573,9 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
int trunc_only, rc = 0;
int extremes = 0;
+
+ DBG(TAB, ul_debugobj(tb, "recounting widths (termwidth=%zu)", tb->termwidth));
+
/* set basic columns width
*/
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
@@ -546,6 +594,8 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
/* reduce columns with extreme fields
*/
if (width > tb->termwidth && extremes) {
+ DBG(TAB, ul_debugobj(tb, " reduce width (extreme columns)"));
+
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (scols_table_next_column(tb, &itr, &cl) == 0) {
size_t org_width;
@@ -566,9 +616,9 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
}
if (width < tb->termwidth) {
- /* try to found extreme column which fits into available space
- */
if (extremes) {
+ DBG(TAB, ul_debugobj(tb, " enlarge width (extreme columns)"));
+
/* enlarge the first extreme column */
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (scols_table_next_column(tb, &itr, &cl) == 0) {
@@ -596,6 +646,8 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
}
if (width < tb->termwidth && scols_table_is_maxout(tb)) {
+ DBG(TAB, ul_debugobj(tb, " enlarge width (max-out)"));
+
/* try enlarge all columns */
while (width < tb->termwidth) {
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
@@ -611,6 +663,8 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
struct libscols_column *cl = list_entry(
tb->tb_columns.prev, struct libscols_column, cl_columns);
+ DBG(TAB, ul_debugobj(tb, " enlarge width (last column)"));
+
if (!scols_column_is_right(cl) && tb->termwidth - width > 0) {
cl->width += tb->termwidth - width;
width = tb->termwidth;
@@ -626,6 +680,11 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
while (width > tb->termwidth) {
size_t org = width;
+ DBG(TAB, ul_debugobj(tb, " reduce width (current=%zu, "
+ "wanted=%zu, mode=%s)",
+ width, tb->termwidth,
+ trunc_only ? "trunc-only" : "all-relative"));
+
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (scols_table_next_column(tb, &itr, &cl) == 0) {
if (width <= tb->termwidth)
@@ -661,20 +720,9 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
}
}
-/*
- fprintf(stderr, "terminal: %d, output: %d\n", tb->termwidth, width);
+ DBG(TAB, ul_debugobj(tb, " result: %zu", width));
+ ON_DBG(TAB, dbg_columns(tb));
- scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
- while (scols_table_next_column(tb, &itr, &cl) == 0) {
- fprintf(stderr, "width: %s=%zd [hint=%d, avg=%zd, max=%zd, extreme=%s]\n",
- cl->name, cl->width,
- cl->width_hint > 1 ? (int) cl->width_hint :
- (int) (cl->width_hint * tb->termwidth),
- cl->width_avg,
- cl->width_max,
- cl->is_extreme ? "yes" : "not");
- }
-*/
return rc;
}
@@ -716,6 +764,7 @@ int scols_print_table(struct libscols_table *tb)
if (!tb)
return -1;
+ DBG(TAB, ul_debugobj(tb, "printing"));
if (!tb->symbols)
scols_table_set_symbols(tb, NULL); /* use default */
@@ -773,6 +822,8 @@ int scols_print_table_to_string(struct libscols_table *tb, char **data)
if (!tb)
return -EINVAL;
+ DBG(TAB, ul_debugobj(tb, "printing to string"));
+
/* create a stream for output */
stream = open_memstream(data, &sz);
if (!stream)
diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c
index d869a23ef..09cded773 100644
--- a/login-utils/lslogins.c
+++ b/login-utils/lslogins.c
@@ -1384,6 +1384,8 @@ int main(int argc, char *argv[])
} else if (argc != optind)
usage(stderr);
+ scols_init_debug(0);
+
/* lslogins -u -s == lslogins */
if (lslogins_flag & F_USRAC && lslogins_flag & F_SYSAC)
lslogins_flag &= ~(F_USRAC | F_SYSAC);
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 3386061cb..16250ae64 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -1443,6 +1443,7 @@ int main(int argc, char *argv[])
* initialize libmount
*/
mnt_init_debug(0);
+ scols_init_debug(0);
tb = parse_tabfiles(tabfiles, ntabfiles, tabtype);
if (!tb)
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 2eac8b80a..688ee6dea 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -1697,6 +1697,7 @@ int main(int argc, char *argv[])
errx(EXIT_FAILURE, _("the sort column has to be between output columns."));
mnt_init_debug(0);
+ scols_init_debug(0);
/*
* initialize output columns
diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
index 1495bd4d6..1e5dbd930 100644
--- a/misc-utils/lslocks.c
+++ b/misc-utils/lslocks.c
@@ -594,6 +594,8 @@ int main(int argc, char *argv[])
&ncolumns, column_name_to_id) < 0)
return EXIT_FAILURE;
+ scols_init_debug(0);
+
rc = get_local_locks(&locks);
if (!rc && !list_empty(&locks))
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 6ad94be4c..b1fda7368 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -297,6 +297,8 @@ static int show_table(struct loopdev_cxt *lc,
struct libscols_line *ln;
int i, rc = 0;
+ scols_init_debug(0);
+
if (!(tb = scols_new_table()))
err(EXIT_FAILURE, _("failed to initialize output table"));
scols_table_enable_raw(tb, raw);
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 3b3faf81a..6b128b140 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1395,8 +1395,11 @@ print_readable(struct lscpu_desc *desc, int cols[], int ncols,
int i;
char buf[BUFSIZ];
const char *data;
- struct libscols_table *table = scols_new_table();
+ struct libscols_table *table;
+ scols_init_debug(0);
+
+ table = scols_new_table();
if (!table)
err(EXIT_FAILURE, _("failed to initialize output table"));
diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c
index d37ec651e..826507ce3 100644
--- a/sys-utils/prlimit.c
+++ b/sys-utils/prlimit.c
@@ -618,6 +618,8 @@ int main(int argc, char **argv)
columns[ncolumns++] = COL_UNITS;
}
+ scols_init_debug(0);
+
if (list_empty(&lims)) {
/* default is to print all resources */
size_t n;
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index 4f98500ef..8c36b2c85 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -236,6 +236,8 @@ static int show_table(int bytes)
if (!itr)
err(EXIT_FAILURE, _("failed to initialize libmount iterator"));
+ scols_init_debug(0);
+
table = scols_new_table();
if (!table)
err(EXIT_FAILURE, _("failed to initialize output table"));
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c
index d63a110e3..137649a3d 100644
--- a/sys-utils/wdctl.c
+++ b/sys-utils/wdctl.c
@@ -250,6 +250,8 @@ static int show_flags(struct wdinfo *wd, uint32_t wanted)
struct libscols_table *table;
uint32_t flags;
+ scols_init_debug(0);
+
/* create output table */
table = scols_new_table();
if (!table) {