Merge commit 'jrollins/master'
[monkeysphere.git] / src / common
index 00ee7b04a124db6679959c35b5c000b2e9ea2389..e98f1bcb35369d04af794d5eba49c6aeaf7cde51 100644 (file)
@@ -18,10 +18,17 @@ ETC="/etc/monkeysphere"
 export ETC
 CACHE="/var/cache/monkeysphere"
 export CACHE
+ERR=0
+export ERR
 
 ########################################################################
 ### UTILITY FUNCTIONS
 
+error() {
+    log "$1"
+    ERR=${2:-'1'}
+}
+
 failure() {
     echo "$1" >&2
     exit ${2:-'1'}
@@ -29,12 +36,12 @@ failure() {
 
 # write output to stderr
 log() {
-    echo -n "ms: " 1>&2
-    echo "$@" 1>&2
+    echo -n "ms: " >&2
+    echo "$@" >&2
 }
 
 loge() {
-    echo "$@" 1>&2
+    echo "$@" >&2
 }
 
 # cut out all comments(#) and blank lines from standard input