Log level is set to WARNING unless -d flag is used
-d flag now sets logging to debugstable
parent
0e431bec54
commit
74c0f189a0
20
src/rhosts.c
20
src/rhosts.c
|
|
@ -23,13 +23,19 @@
|
|||
#include "rhosts.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
struct entry *entries;
|
||||
struct config config;
|
||||
config.loglevel = CLOGS_WARNING;
|
||||
int rc =0;
|
||||
|
||||
|
||||
if (argc >1){
|
||||
consume_args(&config, argc, argv);
|
||||
}
|
||||
clogs_init_config(CLOGS_TIMESTAMP | CLOGS_USELOGFILE, \
|
||||
"/var/log/rhosts.log", CLOGS_DEBUG);
|
||||
"/var/log/rhosts.log", config.loglevel);
|
||||
|
||||
clogs_print(CLOGS_DEBUG,"Initialized settting up logs");
|
||||
rc = parse_config(&entries);
|
||||
|
|
@ -247,3 +253,11 @@ int copy_tmp_to_hosts(){
|
|||
remove(TMPLOCATION);
|
||||
return 0;
|
||||
}
|
||||
int consume_args(struct config *config, int argc, char **argv){
|
||||
int i=0;
|
||||
for (i=1;i < argc;i++){
|
||||
if (strcmp(argv[i], "-d") == 0)
|
||||
config->loglevel = CLOGS_DEBUG;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ struct entry{
|
|||
int entrytype;
|
||||
char entry[MAXSTRSIZE];
|
||||
};
|
||||
struct config{
|
||||
uint8_t loglevel;
|
||||
};
|
||||
|
||||
int parse_config(struct entry **entries);
|
||||
|
||||
|
|
@ -65,6 +68,7 @@ short int determine_config_entry_value(char *buff);
|
|||
int preserve_static_entries();
|
||||
int add_site_entries(struct entry **entries);
|
||||
int copy_tmp_to_hosts();
|
||||
int consume_args(struct config *config, int argc, char **argv);
|
||||
#endif
|
||||
#ifndef DOWNLOAD_HEADER
|
||||
#include "download.h"
|
||||
|
|
|
|||
Loading…
Reference in New Issue