nfs-ganesha 1.4
|
00001 /* 00002 Copyright (c) 2004 The Regents of the University of Michigan. 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions 00007 are met: 00008 00009 1. Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 2. Redistributions in binary form must reproduce the above copyright 00012 notice, this list of conditions and the following disclaimer in the 00013 documentation and/or other materials provided with the distribution. 00014 3. Neither the name of the University nor the names of its 00015 contributors may be used to endorse or promote products derived 00016 from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 00019 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00020 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00021 DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00022 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00023 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00024 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 00025 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00026 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00027 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 */ 00030 00031 #ifdef HAVE_CONFIG_H 00032 #include <config.h> 00033 #endif /* HAVE_CONFIG_H */ 00034 00035 #include <stdio.h> 00036 #include <stdarg.h> 00037 #include <string.h> 00038 00039 #include "err_util.h" 00040 00041 #if NFS_GANESHA 00042 00043 #include "log.h" 00044 00045 void gssd_err_default(int priority, const char *fmt, ...) 00046 { 00047 /* XXX do something */ 00048 } 00049 00050 gssd_err_func_t gss_err = (gssd_err_func_t) gssd_err_default; 00051 00052 void initerr(char *progname, int set_verbosity, int set_fg) 00053 { 00054 /* do nothing */ 00055 } 00056 00057 void gssd_set_err(gssd_err_func_t func) 00058 { 00059 gss_err = func; 00060 } 00061 00062 int get_verbosity(void) 00063 { 00064 return (0); 00065 } 00066 00067 #else /* ! GANESHA */ 00068 00069 #include "xlog.h" 00070 00071 static int verbosity = 0; 00072 static int fg = 0; 00073 00074 void initerr(char *progname, int set_verbosity, int set_fg) 00075 { 00076 verbosity = set_verbosity; 00077 fg = set_fg; 00078 if (!fg) 00079 xlog_open(progname); 00080 } 00081 00082 00083 void printerr(int priority, char *format, ...) 00084 { 00085 va_list args; 00086 00087 /* Don't bother formatting a message we're never going to print! */ 00088 if (priority > verbosity) 00089 return; 00090 00091 va_start(args, format); 00092 if (fg) 00093 vfprintf(stderr, format, args); 00094 else 00095 xlog_backend(L_ERROR, format, args); 00096 va_end(args); 00097 } 00098 00099 int get_verbosity(void) 00100 { 00101 return verbosity; 00102 } 00103 00104 #endif /* ! NFS_GANESHA */