monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-l cmd line arg broken


From: Aaron Scamehorn
Subject: -l cmd line arg broken
Date: Fri, 1 Dec 2006 14:52:17 -0600

Hello,

It looks like it is impossible to get any output to go to a log file specified via the cmd line args…

From main, handle_options properly handles the cmd line arg, and sets Run.dolog, but do_init calls parse, which calls preparse, which sets Run.dolog=FALSE.

I don't think this last step is necessary.

Thanks,
Aaron



int main(int argc, char **argv) {

  prog= Util_basename(argv[0]);
  init_env();
  handle_options(argc, argv);

  do_init();
  do_action(argv);
  do_exit();

  return 0;

}

static void handle_options(int argc, char **argv) {
    . 
    . 
    .
    case 'l':
        Run.logfile= xstrdup(optarg);
         if(IS(Run.logfile, "syslog"))
             Run.use_syslog= TRUE;
         Run.dolog= TRUE;
        break;
    . 
    . 
    .
}

static void do_init() {
    . 
    . 
    .
    if(! parse(Run.controlfile)) {
        exit(1);
    }
    . 
    . 
    .
}

int parse(char *controlfile) {
    . 
    . 
    .
    preparse();
    . 
    . 
    .
}

static void preparse() {
    .  .  .
    Run.dolog= FALSE
    .  .  .
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]