Commit Graph

249 Commits

Author SHA1 Message Date
Sami Kerola fcf841f8d3 misc: fix typos
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-11-28 14:39:13 +01:00
Karel Zak d1bf0ce5fa libsmartcols: fix mem-leaks in samples
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-23 15:24:59 +01:00
Karel Zak f086478af4 libsmartcols: (sample) cleanup line separator usage
* add comment to explain when nolinesep flag is necessary
* force to print \n before switch to the next line to support

	  ./sample-scols-continuous > file

use case.

Addresses: https://github.com/ignatenkobrain/python-smartcols/issues/18
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-10-12 12:03:57 +02:00
Karel Zak 1e46776263 libsmartcols: (docs) add note about line separators
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-10-12 11:33:49 +02:00
Karel Zak a30f2a9b7a libsmartcols: don't call free_buffer() for uninitialized variable [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-10-11 15:06:41 +02:00
Karel Zak 7928a926a0 libsmartcols: fix scols_line_move_cells() n+1 error [asan]
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-18 10:41:20 +02:00
Karel Zak 1ed968c526 libsmartcols: fix heap-buffer-overflow when move columns
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-15 13:43:54 +02:00
Karel Zak c43874baa6 libsmartcols: fix comment (to make gtk-docs happy)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-31 13:33:11 +02:00
Karel Zak 28a3cc83c5 libsmartcols: add scols_table_enable_noencoding()
Now the library encode all output. It seems too strict and difficult
to use the library for some use-cases -- for example if you want to
use the library for already colorized output (by esc.sequences).

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-07-31 11:45:23 +02:00
Ruediger Meier 6e1eda6f22 misc: never use usage(stderr)
Here we fix all cases where we have usage(FILE*)
functions.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Sami Kerola f4d3783867 misc: remove stray semicolons
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:21:29 +02:00
Sami Kerola 1b5042636f misc: fix reassigned values before old ones has been used [cppcheck]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-06-14 12:19:20 +02:00
Ruediger Meier 59879322e6 libsmartcols: fix warning "unused parameter"
Noticed on OSX.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-13 23:39:22 +02:00
Karel Zak f12e437436 libsmartcols: (docs) add new functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-13 11:17:06 +02:00
Karel Zak 36e07cebf1 libsmartcols: add header-repeat feature
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-13 11:11:17 +02:00
Karel Zak 5df8f14c30 libsmartcols: add missing symbols
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-12 16:35:58 +02:00
Karel Zak e33b387483 libsmartcols: add scols_table_{set,get}_termheight()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-12 11:51:36 +02:00
Karel Zak f46a8d7e66 lib/ttyutils: return terminal lines too
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-12 11:38:38 +02:00
Ruediger Meier c0d7b11a3f build-sys: fix library order when linking
We got some errors on Alpine Linux where $LTLIBINTL is non-empty:

./.libs/libcommon.a(libcommon_la-blkdev.o): In function `open_blkdev_or_file':
lib/blkdev.c:282: undefined reference to `libintl_gettext
collect2: error: ld returned 1 exit status

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-01 03:16:48 +02:00
Karel Zak 4ab60277cb libsmartcols: (docs) add missing 'since' tags
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-23 13:27:29 +02:00
Karel Zak 1ce46fcf6b libsmartcols: check scols_table_set_default_symbols() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-17 12:50:36 +02:00
Karel Zak eebf2dd89b libsmartcols: add scols_line_is_ancestor()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-05 12:12:43 +02:00
Karel Zak 7e2a4ef700 libsmartcols: add debug mesg to see width change
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:18:00 +02:00
Karel Zak c8341f418a libsmartcols: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-13 11:47:43 +02:00
Karel Zak 066f46e0ee libsmartcols: add scols_sort_table_by_tree()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-13 11:19:59 +02:00
Karel Zak 14cd0a67a3 libsmartcols: fix relative width interpretation
The non-defined width hint (=0) should not be interpreted as relative width.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-07 14:34:11 +02:00
Karel Zak f691831481 libsmartcols: column width reduction refactoring
The current implementation is unreadable... Let's write it again with
more obvious semantic.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-07 14:34:11 +02:00
Karel Zak 48645e7bbb libsmartcols: add scols_line_move_cells()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-07 14:34:11 +02:00
Karel Zak 7bdefc7fc0 libsmartcols: add scols_table_move_column()
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-04-07 14:34:11 +02:00
Sami Kerola 71f08e9706
tests: do not use plain 0 as NULL [smatch scan]
Likewise commit 8791804065.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-03-17 21:22:26 +00:00
Sami Kerola 4ff3d13b43
libsmartcols: fix test variable shadowing
libsmartcols/samples/fromfile.c:57:16: warning: declaration of 'flags'
shadows a global declaration [-Wshadow]
libsmartcols/samples/fromfile.c:29:33: note: shadowed declaration is here
libsmartcols/samples/fromfile.c:101:8: warning: declaration of 'flags'
shadows a global declaration [-Wshadow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-03-17 21:22:26 +00:00
Karel Zak 1765814521 libsmartcols: allow to add column to already used table
Now it's impossible to add new column if the table already contains
lines with data. This patch forces library to realloc cell array in
the lines to accept a new column.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-03 10:37:37 +01:00
Karel Zak c14224b374 libsmartcols: support columns separators greater than one output cell
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-02 16:56:39 +01:00
Yuri Chornoivan a7349ee315 docs: Fix word repetitions 2017-02-13 14:10:12 +01:00
Karel Zak 6ffbd28359 libsmartcols: add scols_cell_get_alignment()
Just to hide that we use cell flags (bitwise operations) to define
cell content alignment. The patch also more explicitly specifies the
flags in the header file.

The alignment is evaluated in the order: right, center, left. The
default is left.

Note that SCOLS_CELL_FL_* are used for for table title only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-09 13:28:24 +01:00
Karel Zak efc0795811 Merge branch 'ignatenko/libsmartcols-dead' of https://github.com/ignatenkobrain/util-linux
* 'ignatenko/libsmartcols-dead' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: remove dead checks
2017-01-09 13:07:37 +01:00
Karel Zak 1f408f0220 libsmartcols: unused parameter [-Wunused-parameter]
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-05 12:31:26 +01:00
Igor Gnatenko 16e64b6822 libsmartcols: remove dead checks
We initialize them before.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 23:36:48 +01:00
Sébastien Helleu d673b74e9d docs: replace FTP by HTTPS in kernel.org URLs
The links to ftp://ftp.kernel.org/ are replaced by
https://www.kernel.org/.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 11:22:26 +01:00
Ruediger Meier 12f17a23df misc: fix typos using codespell
# command used was:
 $ ~/src/codespell/codespell \
   -w -D /home/rudi/src/codespell/build/lib/codespell_lib/data/dictionary.txt \
   $(git ls-files | grep -v "^po/\|\.xz$\|\.gz$\|\.bz2$\|\.img$\|^Documentation/releases/")

 BTW some manually grammer fixes:
   s/uses/used/
   s/begin/beginning/

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-01 00:01:43 +01:00
Karel Zak 95a528ddbc libsmartcols: make scols_sort_table() usable for trees
We also need to sort children when tree is enabled.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-02 14:39:08 +01:00
Ruediger Meier 332123f2b6 misc: fix some compiler warnings
libsmartcols/samples/fromfile.c:59:2: warning: passing argument 3 of 'string_to_bitmask' from incompatible pointer type
  text-utils/pg.c:79:0: warning: "TABSIZE" redefined
  libblkid/src/read.c:455:13: warning: 'debug_dump_dev' defined but not used [-Wunused-function]
  libblkid/src/probe.c:769:13: warning: unused function 'cdrom_size_correction' [-Wunused-function]
  /usr/include/sys/termios.h:3:2: warning: "this file includes <sys/termios.h> which is deprecated, use <termios.h> instead" [-W#warnings]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-10-27 11:03:24 +02:00
Karel Zak 82053f5e3d libsmartcols: add scols_column_add_width()
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-30 11:01:41 +02:00
Karel Zak 68a7f92b94 libsmartcols: custom wrap fixes
Reported-by: Igor Gnatenko <i.gnatenko.brain@gmail.com
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-27 14:16:18 +02:00
Karel Zak 81b176c4da docs: some random fixes
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-27 12:52:47 +02:00
Karel Zak 3f47320a17 libsmartcols: (docs) add missing version notes
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-27 11:35:43 +02:00
Igor Gnatenko 618a1d6dbe libsmartcols: fixes in doc generation
* Add 2.29 symbols index
* Sync argument names between header and implementation

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-09-27 11:19:03 +02:00
Karel Zak 949ea05f1a libsmartcols: support custom wrap and remove SCOLS_FL_WRAPNL
This new API provides full control on multi-line cells, you can wrap
text by new lines (build-in support) or by another way (after words,
commas, etc.) Changes:

* new scols_column_set_wrapfunc() sets pointers to two callback functions

   1/ chunksize() - returns largest data chunk size; used when we
                    calculate columns width
   2/ nextchunk() - terminate the current chunk and returns pointer to
                    the next; used when we print data

* remove SCOLS_FL_WRAPNL and add new functions scols_wrapnl_chunksize()
  and scols_wrapnl_nextchunk() to provide build-in functionality to
  wrap cells on \n

* remove scols_column_is_wrapnl() add scols_column_is_customwrap()
  (returns true if custom wrap functions are defined)

* add scols_column_set_safechars() and scols_column_get_safechars() to
  allow to control output encoding, safe chars are not encoded by \xFOO

* modify "fromfile" test code to use build-in scols_wrapnl_* callbacks
  for "wrapnl" tests

* add new function scols_column_get_table()

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-26 11:20:07 +02:00
Karel Zak 0d71eb9c4b libsmartcols: (docs) add missing functions
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-23 14:31:06 +02:00
Karel Zak a3b91e82f2 Merge branch 'getters' of https://github.com/ignatenkobrain/util-linux
* 'getters' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: add scols_table_is_nolinesep()
  libsmartcols: add scols_table_is_nowrap()
  libsmartcols: add scols_table_get_name()
2016-09-23 14:25:37 +02:00