> Mike:
> The upstream maintainer of this package is not interested in adding
> printf due to portability reasons, but if someone would contribute a
> patch, I'd happily apply it.
Here is patch which I think is acceptible to upstream as well. The
printn() function takes advantage of printf() if found from the
system. The result is nice, tabular, output for human inspection.
Checking `amd'... not found
Checking `basename'... not infected
Checking `biff'... not found
Checking `chfn'... not infected
Checking `chsh'... not infected
Checking `cron'... not infected
Checking `crontab'... not infected
Checking `date'... not infected
Checking `du'... not infected
...
It would be nice if accepted by upstream, but a Debian patch would also
suffice.
Jari
>From 1e9620197ff9bf590ca5af2d8f59c1121c9755cb Mon Sep 17 00:00:00 2001
From: Jari Aalto <[EMAIL PROTECTED]>
Date: Thu, 18 Sep 2008 15:55:26 +0300
Subject: [PATCH] chkrootkit: (printn): Use printf if available.
Signed-off-by: Jari Aalto <[EMAIL PROTECTED]>
---
chkrootkit | 30 +++++++++++++++++++++++++++---
1 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/chkrootkit b/chkrootkit
index 7999b6f..0875a77 100755
--- a/chkrootkit
+++ b/chkrootkit
@@ -2607,10 +2607,34 @@ chk_telnetd () {
printn ()
{
- if `${echo} "a\c" | ${egrep} c >/dev/null 2>&1` ; then
- ${echo} -n "$1"
+ printf="use printf"
+ printf_fmt="%-60s"
+
+ if [ ! "$PRINTF_BIN" ]; then
+ # This is first time call to use. Check environment and
+ # define this global.
+
+ PRINTF_BIN=`which printf 2> /dev/null`
+
+ # Set to dummy, if not found
+ [ ! "$PRINTF_BIN" ] && PRINTF_BIN="not exists"
+
+ # We're done, and won't enter this if-case any more
+ fi
+
+ # Some messages are continued, so don't use printf
+ case "$1" in
+ *exec*|*bogus*) printf="" ;;
+ esac
+
+ if [ "$PRINTF_BIN" ] && [ "$printf" ]; then
+ $PRINTF_BIN "$printf_fmt" "$1"
else
- ${echo} "${1}\c"
+ if `${echo} "a\c" | ${egrep} c >/dev/null 2>&1` ; then
+ ${echo} -n "$1"
+ else
+ ${echo} "${1}\c"
+ fi
fi
}
--
1.5.6.5