summaryrefslogtreecommitdiffstats
path: root/libsmartcols/samples
diff options
context:
space:
mode:
authorKarel Zak2016-09-13 14:12:11 +0200
committerKarel Zak2016-09-13 14:12:11 +0200
commita414a1709387298c633d0f549bde5d0459b43a31 (patch)
tree14e155ce107e54be84e513c98daab160c125da3e /libsmartcols/samples
parentlibsmartcols: add functions to control terminal usage (diff)
downloadkernel-qcow2-util-linux-a414a1709387298c633d0f549bde5d0459b43a31.tar.gz
kernel-qcow2-util-linux-a414a1709387298c633d0f549bde5d0459b43a31.tar.xz
kernel-qcow2-util-linux-a414a1709387298c633d0f549bde5d0459b43a31.zip
tests: improve libsmartcols test
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/samples')
-rw-r--r--libsmartcols/samples/fromfile.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libsmartcols/samples/fromfile.c b/libsmartcols/samples/fromfile.c
index 361de01c7..ec12267a6 100644
--- a/libsmartcols/samples/fromfile.c
+++ b/libsmartcols/samples/fromfile.c
@@ -156,6 +156,7 @@ int main(int argc, char *argv[])
{ "maxout", 0, 0, 'm' },
{ "column", 1, 0, 'c' },
{ "nlines", 1, 0, 'n' },
+ { "width", 1, 0, 'w' },
{ NULL, 0, 0, 0 },
};
@@ -167,7 +168,7 @@ int main(int argc, char *argv[])
if (!tb)
err(EXIT_FAILURE, "failed to create output table");
- while((c = getopt_long(argc, argv, "c:mn:", longopts, NULL)) != -1) {
+ while((c = getopt_long(argc, argv, "c:mn:w:", longopts, NULL)) != -1) {
switch(c) {
case 'c': /* add column from file */
{
@@ -189,6 +190,10 @@ int main(int argc, char *argv[])
case 'n':
nlines = strtou32_or_err(optarg, "failed to parse number of lines");
break;
+ case 'w':
+ scols_table_set_termforce(tb, SCOLS_TERMFORCE_ALWAYS);
+ scols_table_set_termwidth(tb, strtou32_or_err(optarg, "failed to parse terminal width"));
+ break;
default:
err(EXIT_FAILURE, "%s [-r|--random]\n", program_invocation_short_name);
}