1 | #########################################################################
|
---|
2 | #
|
---|
3 | # Printing/logging Subroutines
|
---|
4 | #
|
---|
5 | #########################################################################
|
---|
6 | #
|
---|
7 | # Copyright Rainer Wichmann (2005)
|
---|
8 | #
|
---|
9 | # License Information:
|
---|
10 | # This program is free software; you can redistribute it and/or modify
|
---|
11 | # it under the terms of the GNU General Public License as published by
|
---|
12 | # the Free Software Foundation; either version 2 of the License, or
|
---|
13 | # (at your option) any later version.
|
---|
14 | #
|
---|
15 | # This program is distributed in the hope that it will be useful,
|
---|
16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
18 | # GNU General Public License for more details.
|
---|
19 | #
|
---|
20 | # You should have received a copy of the GNU General Public License
|
---|
21 | # along with this program; if not, write to the Free Software
|
---|
22 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
23 | #
|
---|
24 |
|
---|
25 | # Fatal error
|
---|
26 | #
|
---|
27 | printFATAL() {
|
---|
28 | printERROR ${1+"$@"}
|
---|
29 | main_exit_status=1
|
---|
30 | echo '1' > "$tmpERR"
|
---|
31 | (exit 1); exit 1;
|
---|
32 | }
|
---|
33 |
|
---|
34 | # Print a message to stderr
|
---|
35 | #
|
---|
36 | printERROR() {
|
---|
37 | echo "ERROR:" ${1+"$@"} >&2
|
---|
38 | }
|
---|
39 |
|
---|
40 | # Print a message to stderr
|
---|
41 | #
|
---|
42 | printWARNING() {
|
---|
43 | echo "WARNING:" ${1+"$@"} >&2
|
---|
44 | }
|
---|
45 |
|
---|
46 | # Print a message to stdout
|
---|
47 | #
|
---|
48 | printLOG() {
|
---|
49 | if test $silent -lt 2
|
---|
50 | then
|
---|
51 | now=`date`
|
---|
52 | if test -z "$logfile"
|
---|
53 | then
|
---|
54 | if test x"$simulate" = x0
|
---|
55 | then
|
---|
56 | echo "${now}:" ${1+"$@"}
|
---|
57 | else
|
---|
58 | echo "${now}: (simulate)" ${1+"$@"}
|
---|
59 | fi
|
---|
60 | else
|
---|
61 | if test x"$simulate" = x0
|
---|
62 | then
|
---|
63 | echo "${now}:" ${1+"$@"} >"$logfile"
|
---|
64 | else
|
---|
65 | echo "${now}: (simulate)" ${1+"$@"} >"$logfile"
|
---|
66 | fi
|
---|
67 | fi
|
---|
68 | fi
|
---|
69 | }
|
---|
70 |
|
---|
71 | # Print a message to stdout
|
---|
72 | #
|
---|
73 | printINFO() {
|
---|
74 | if test x"$silent" = x0
|
---|
75 | then
|
---|
76 | if test x"$simulate" = x0
|
---|
77 | then
|
---|
78 | echo ${1+"$@"}
|
---|
79 | else
|
---|
80 | echo "(simulate)" ${1+"$@"}
|
---|
81 | fi
|
---|
82 | fi
|
---|
83 | }
|
---|
84 |
|
---|