File: linedup_reports.dpatch

package info (click to toggle)
chkrootkit 0.48-8
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 448 kB
  • ctags: 221
  • sloc: sh: 3,174; ansic: 1,474; makefile: 88
file content (49 lines) | stat: -rw-r--r-- 1,192 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/sh /usr/share/dpatch/dpatch-run
## linedup_reports by Jari Aalto <jari.aalto@cante.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: (printn): Use printf if available (#343284)

@DPATCH@
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
 }