summaryrefslogtreecommitdiffstatsabout
path: root/utility/shell.c
diff options
context:
space:
mode:
Diffstat (limited to 'utility/shell.c')
-rw-r--r--utility/shell.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/utility/shell.c b/utility/shell.c
index eaa7098..94cca35 100644
--- a/utility/shell.c
+++ b/utility/shell.c
@@ -9,6 +9,7 @@
9#include "shell.h" 9#include "shell.h"
10#include "config.h" 10#include "config.h"
11#include "logparse.h" 11#include "logparse.h"
12#include "database.h"
12 13
13const apr_getopt_option_t _opt_config[] = { 14const apr_getopt_option_t _opt_config[] = {
14 {"machineid", 'm', 1, "Machine ID for the log file"}, 15 {"machineid", 'm', 1, "Machine ID for the log file"},
@@ -122,9 +123,11 @@ int main(int argc, const char *const argv[])
122 exit(1); 123 exit(1);
123 } 124 }
124 125
125 // Process configuration file 126 // Initialize sub systems
126 parser_init(pool); 127 parser_init(pool);
127 config_init(pool); 128 config_init(pool);
129 database_init(pool);
130 // Process configuration file
128 base = config_create(pool); 131 base = config_create(pool);
129 rv = config_read(base, apr_table_get(args,"Config"), args); 132 rv = config_read(base, apr_table_get(args,"Config"), args);
130 apr_pool_destroy(ptemp); 133 apr_pool_destroy(ptemp);
@@ -138,6 +141,10 @@ int main(int argc, const char *const argv[])
138 141
139 // Find files and parse 142 // Find files and parse
140 parser_find_logs(base); 143 parser_find_logs(base);
144 if ((rv = database_connect(base))) {
145 printf("Error Connecting to Database: %d\n",rv);
146 exit(1);
147 }
141 if (!apr_is_empty_array(base->input_files)) { 148 if (!apr_is_empty_array(base->input_files)) {
142 char **filelist; 149 char **filelist;
143 int f, l; 150 int f, l;
@@ -149,5 +156,6 @@ int main(int argc, const char *const argv[])
149 } else { 156 } else {
150 printf("No input files\n"); 157 printf("No input files\n");
151 } 158 }
159 database_disconnect(base);
152 return 0; 160 return 0;
153} 161}