summaryrefslogtreecommitdiffstats
path: root/lib/pager.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/pager: fix compiler warning [-Wrestrict]Karel Zak2018-07-181-2/+4
| | | | | | | lib/pager.c: In function ‘pager_preexec’: lib/pager.c:148:12: warning: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Wrestrict] Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/exec_shell: (and pager) use errexec()Karel Zak2018-02-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: check open() return code [coverity scan]Karel Zak2017-10-111-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: use xallocKarel Zak2017-06-021-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: don't use pager if command not availableKarel Zak2017-06-011-0/+36
| | | | | | | | | | | | | | | | | | for example: # PAGER=foo dmesg -H sh: foo: command not found the same problem is we have with fdisk 'l' command: # PAGER=foo fdisk /dev/sda Welcome to fdisk (util-linux 2.30-rc2-33-41b71). ... Command (m for help): l sh: foo: command not found It seems better to don't use pager at all if not available. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: use unique ifdefs for testsKarel Zak2017-01-041-2/+2
| | | | | | | Let's use unique TEST_PROGRAM_<NAME> ifdefs to make build system more robust. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: fix testKarel Zak2016-08-261-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: restore signals setting by pager_close()Karel Zak2016-08-261-5/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: cleanup and extend APIKarel Zak2016-08-261-4/+51
| | | | | | | | | * clean up function names * add functions to temporary redirect to the pager and then restore original terminal output Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: always check setenv(3) return valueSami Kerola2016-08-121-1/+2
| | | | | | At least glibc setenv(3) can fail when system runs out of memory. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: add missing includesRuediger Meier2016-02-111-0/+1
| | | | | | | | lib/pager.c: signal.h ... raise(3p) lib/sysfs.c: libgen.h ... basename(3p) lib/exec_shell.c: libgen.h ... basename(3p) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib/pager: use names when referring to standard file descriptorsSami Kerola2014-05-061-9/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib: remove unused codeSami Kerola2013-06-071-10/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/pager: robust work with file descriptors [coverity scan]Karel Zak2012-09-071-2/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/pager: minor compiler warning fixesSami Kerola2012-07-161-1/+3
| | | | | | | | | Add missing function prototype, and declare structure before use of it. lib/pager.c:162:6: warning: no previous prototype for function 'setup_pager' [-Wmissing-prototypes] lib/pager.c:20:29: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct child_process' [-Wtentative-definition-incomplete-type] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build: fix unused parameter warningsSami Kerola2012-06-111-1/+2
| | | | | | | | | | | | | | | pager.c:203:14: warning: unused parameter 'argc' [-Wunused-parameter] pager.c:203:26: warning: unused parameter 'argv' [-Wunused-parameter] randutils.c:108:14: warning: unused parameter 'argc' [-Wunused-parameter] randutils.c:108:26: warning: unused parameter 'argv' [-Wunused-parameter] optstr.c:774:37: warning: unused parameter 'optstr' [-Wunused-parameter] optstr.c:774:51: warning: unused parameter 'value' [-Wunused-parameter] optstr.c:774:65: warning: unused parameter 'valsz' [-Wunused-parameter] optstr.c:774:79: warning: unused parameter 'next' [-Wunused-parameter] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/pager: fix compiler warningsKarel Zak2012-04-231-4/+2Star
| | | | | | | | | | | pager.c: In function ‘start_command’: pager.c:82:7: warning: unused variable ‘err’ [-Wunused-variable] pager.c:49:25: warning: unused variable ‘fderr’ [-Wunused-variable] pager.c:49:15: warning: unused variable ‘fdout’ [-Wunused-variable] pager.c:48:25: warning: unused variable ‘need_err’ [-Wunused-variable] pager.c:48:15: warning: unused variable ‘need_out’ [-Wunused-variable] Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add pager functionalityDavidlohr Bueso2012-04-231-0/+214
When some program' output exceeds the terminal's dimensions, it is a nice feature to call a pager that acts as calling 'less' to allow better user navigation. This patch adds this functionality, based on what perf and git have (ie: git log). Signed-off-by: Davidlohr Bueso <dave@gnu.org>