From a4270020addc324fb60d2b1b446b41bc31e3baf8 Mon Sep 17 00:00:00 2001 From: Lucas Castro Date: Wed, 10 Jan 2024 22:33:44 -0300 Subject: Import Upstream version 1.0.4 --- globals.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 globals.c (limited to 'globals.c') diff --git a/globals.c b/globals.c new file mode 100644 index 0000000..9af3a6f --- /dev/null +++ b/globals.c @@ -0,0 +1,126 @@ +/* + +(C) 2009-2011 Mika Ilmaranta + +License: GPLv2 + +*/ + +#include +#include + +#include "globals.h" +#include "defs.h" + +static char *prog = NULL; +static int cont = TRUE; +static int dump = FALSE; +static int ident = 0; +static int reload_cfg = FALSE; +static int dump_if_list = FALSE; +static char *configfile = "/etc/lsm/lsm.conf"; +static char *pidfile = "/var/run/lsm.pid"; +static int nodaemon = 0; +static char *status_str[] = { "down", "up", "unknown", "long_down" }; + +void set_prog(char *val) +{ + prog = val; +} + +char *get_prog(void) +{ + if(prog == NULL) { + syslog(LOG_ERR, "%s: called with prog unset", __FUNCTION__); + return("prog unset"); + } + + return(prog); +} + +void set_cont(const int val) +{ + cont = val; +} + +int get_cont(void) +{ + return(cont); +} + +void set_dump(const int val) +{ + dump = val; +} + +int get_dump(void) +{ + return(dump); +} + +void set_ident(const int val) +{ + ident = val; +} + +int get_ident(void) +{ + return(ident); +} + +void set_reload_cfg(const int val) +{ + reload_cfg = val; +} + +int get_reload_cfg(void) +{ + return(reload_cfg); +} + +void set_dump_if_list(const int val) +{ + dump_if_list = val; +} + +int get_dump_if_list(void) +{ + return(dump_if_list); +} + +void set_configfile(char *val) +{ + configfile = val; +} + +char *get_configfile(void) +{ + return(configfile); +} + +void set_pidfile(char *val) +{ + pidfile = val; +} + +char *get_pidfile(void) +{ + return(pidfile); +} + +void set_nodaemon(const int val) +{ + nodaemon = val; +} + +int get_nodaemon(void) +{ + return(nodaemon); +} + +char *get_status_str(STATUS val) +{ + return(status_str[val]); +} + +/* EOF */ -- cgit v1.2.3