Slashdot Mirror


Bayesian Tail

flok writes "We all know anti-spam-software using Bayesian filtering. The results with these are amazingly good. So that made me thinking: why not create a tool which monitors logfiles and determines using a Bayesian filter what events to display and what not? That's why I created btail. Btail is just that: it monitors a logfile and filters it with a Bayesian filter. The results are above my own expectations!"

1 of 63 comments (clear)

  1. This code belongs on by Safety+Cap · · Score: -1, Troll
    the Daily WTF!

    To Wit:

    char *conf_file = "btail.conf";

    if (argc > 2)
    {
    fprintf(stderr, "Usage: %s [configurationfile]\n", argv[0]);
    return 1;
    }
    else if (argc == 2)
    {
    conf_file = argv[1];
    }
    conf *config = load_config(conf_file);
    C'mon, man... really, WTF? How would the user know from the "error" message that the program will use a default config file (and with what name)?

    That aside, your code would be easier to read (slashcode's broken formatting nonwithstanding) if you used a switch construct.

    // If the user doesn't want to specify a config, we'll use the default
    switch( argc ) {
    case 1:
    confg_file = "btail.conf";
    break;
    case 2:
    conf_file = argv[1];
    break;
    default:
    fprintf(stderr, "Usage: %s [configurationfile (defaults to btail.conf)]\n", argv[0]);
    return 1;
    }
    --
    Yeah, right.