Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / adm / functions / display
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:         display
5 # Description:  Display functions for Korn Shell Scripts
6 # Author:       Andrew@DeFaria.com
7 # Created:      Tue Apr 15 14:20:02 PDT 1997
8 # Modified:
9 # Language:     Bash Shell
10 #
11 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
12 #
13 ################################################################################
14 function error {
15   declare -i errornbr=$2
16
17   if [ $errornbr -ne 0 ]; then
18     echo -e "$me: Error: $1 (Error: $2)"
19     exit $2
20   else
21     echo -e "$me: Error: $1"
22   fi
23 } # error
24
25 function warning {
26   declare -i warningnbr=$2
27
28   if [ $warningnbr -eq 0 ]; then
29     echo -e "$me: Warning: $1"
30   else
31     echo -e "$me: Warning: $1 (Warning: $2)"
32   fi
33 } # warning
34
35 function display {
36   echo -e "$@"
37 } # display
38
39 function display_stderr {
40   echo -e "$@"
41 } # display_stderr
42
43 function info {
44   display "$me: Info: $@"
45 } # info
46
47 unset info
48
49 function verbose {
50   if [ ! -z "$verbose" ]; then
51     display "$@"
52   fi
53 } # verbose
54
55 function debug {
56   if [ ! -z "$debug" ]; then
57     echo -e "$@"
58   fi
59 } # debug