[Pm-utils] [PATCH] Move function log to pm/functions.in

Michal Vyskocil mvyskocil at suse.cz
Tue Sep 14 01:25:53 PDT 2010


The log is called by _rmmod and modreload, so let's have it defined in
the same file and do not expect the pm-functions is sourced first.
---
 pm/functions.in    |    9 +++++++++
 pm/pm-functions.in |   10 ----------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/pm/functions.in b/pm/functions.in
index bd649db..f464293 100644
--- a/pm/functions.in
+++ b/pm/functions.in
@@ -17,6 +17,15 @@ is_set()
 # for great debugging!
 is_set "${PM_DEBUG}" && set -x
 
+# Simple little logging function.
+# We do it this way because 'echo -n' is not posix.
+log()
+{
+	is_set "$LOGGING" || return 0;
+	local fmt='%s\n'
+	[ "$1" = "-n" ] && { fmt='%s'; shift; }
+	printf "$fmt" "$*"
+}
 
 # try to take the lock.  Fail if we cannot get it.
 try_lock()
diff --git a/pm/pm-functions.in b/pm/pm-functions.in
index c82be30..bad9817 100644
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -85,16 +85,6 @@ done
 
 . "${PM_FUNCTIONS}"
 
-# Simple little logging function.
-# We do it this way because 'echo -n' is not posix.
-log()
-{
-	is_set "$LOGGING" || return 0;
-	local fmt='%s\n'
-	[ "$1" = "-n" ] && { fmt='%s'; shift; }
-	printf "$fmt" "$*"
-}
-
 profiling() { [ "$PM_PROFILE" = "true" ]; }
 
 if profiling; then
-- 
1.7.1



More information about the Pm-utils mailing list