Imported Upstream version 2.6.0

This commit is contained in:
arnaud.quette@free.fr 2011-01-26 10:35:08 +01:00
parent 26fb71b504
commit 459aaf9392
510 changed files with 40508 additions and 18859 deletions

View file

@ -33,16 +33,17 @@
const char *UPS_VERSION = NUT_VERSION_MACRO;
int nut_debug_level = 0;
int nut_log_level = 0;
static int upslog_flags = UPSLOG_STDERR;
static void xbit_set(int *val, int flag)
{
*val = (*val |= flag);
*val |= flag;
}
static void xbit_clear(int *val, int flag)
{
*val = (*val ^= (*val & flag));
*val ^= (*val & flag);
}
static int xbit_test(int val, int flag)
@ -70,6 +71,44 @@ void open_syslog(const char *progname)
#endif
openlog(progname, opt, LOG_FACILITY);
switch (nut_log_level)
{
#if HAVE_SETLOGMASK && HAVE_DECL_LOG_UPTO
case 7:
setlogmask(LOG_UPTO(LOG_EMERG)); /* system is unusable */
break;
case 6:
setlogmask(LOG_UPTO(LOG_ALERT)); /* action must be taken immediately */
break;
case 5:
setlogmask(LOG_UPTO(LOG_CRIT)); /* critical conditions */
break;
case 4:
setlogmask(LOG_UPTO(LOG_ERR)); /* error conditions */
break;
case 3:
setlogmask(LOG_UPTO(LOG_WARNING)); /* warning conditions */
break;
case 2:
setlogmask(LOG_UPTO(LOG_NOTICE)); /* normal but significant condition */
break;
case 1:
setlogmask(LOG_UPTO(LOG_INFO)); /* informational */
break;
case 0:
setlogmask(LOG_UPTO(LOG_DEBUG)); /* debug-level messages */
break;
default:
fatalx(EXIT_FAILURE, "Invalid log level threshold");
#else
case 0:
break;
default:
upslogx(LOG_INFO, "Changing log level threshold not possible");
break;
#endif
}
}
/* close ttys and become a daemon */