Skip to contentSkip to conversation

lib: add pager functionality

PATCH Applied Davidlohr Bueso 2 participants 2 messages Apr 2, 2012 – Apr 23, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lib: add pager functionality

From: Davidlohr Bueso <[email protected]>

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).

---
 include/pager.h |    6 ++
 lib/Makefile.am |    2 +
 lib/pager.c     |  214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+), 0 deletions(-)
 create mode 100644 include/pager.h
 create mode 100644 lib/pager.c
include/pager.h new file +6 -0
new file mode 100644
index 0000000..9ca42eb
@@ -0,0 +1,6 @@
+#ifndef UTIL_LINUX_PAGER
+#define UTIL_LINUX_PAGER
+
+void setup_pager(void);
+
+#endif
lib/Makefile.am +2 -0
index c34481d..d27f323 100644
@@ -9,6 +9,7 @@ noinst_PROGRAMS = \
 	test_fileutils \
 	test_ismounted \
 	test_mangle \
+	test_pager \
 	test_procutils \
 	test_strutils \
 	test_tt \
@@ -35,6 +36,7 @@ test_procutils_SOURCES = procutils.c
 if LINUX
 test_cpuset_SOURCES = cpuset.c
 test_sysfs_SOURCES = sysfs.c at.c
+test_pager_SOURCES = pager.c
 test_sysfs_CFLAGS = -DTEST_PROGRAM_SYSFS
 
 test_loopdev_SOURCES = \
lib/pager.c new file +214 -0

214 lines not on this page · raw message

Signature · 1 line
1.7.4.1
maintainer Applied
#1 lore raw
Quoted 6 lines · Davidlohr Bueso
 include/pager.h |    6 ++
 lib/Makefile.am |    2 +
 lib/pager.c     |  214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 222 insertions(+), 0 deletions(-)
 create mode 100644 include/pager.h
 create mode 100644 lib/pager.c

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com