Changeset 2c65def60e6630d515d47a2135e89e7961c4c5b9
- Timestamp:
- 01/26/08 04:20:28
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1201321228 +0000
- git-parent:
[0268e62cb80791dd94220cf6deec916656c7cddd]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1201321228 +0000
- Message:
take some options
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r0268e62 |
r2c65def |
|
| 256 | 256 | AC_SUBST(MODULES_DIR) |
|---|
| 257 | 257 | |
|---|
| | 258 | AC_MSG_CHECKING([Resolving sysconfdir path...]) |
|---|
| | 259 | fullpath=$sysconfdir |
|---|
| | 260 | while test "x$temppath" != "x$fullpath" ; do |
|---|
| | 261 | temppath=$fullpath |
|---|
| | 262 | fullpath=`eval echo ${fullpath}` |
|---|
| | 263 | done |
|---|
| | 264 | fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"` |
|---|
| | 265 | AC_MSG_RESULT([$fullpath]) |
|---|
| | 266 | AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}") |
|---|
| | 267 | ETC_DIR=${fullpath} |
|---|
| | 268 | AC_SUBST(ETC_DIR) |
|---|
| | 269 | |
|---|
| 258 | 270 | |
|---|
| 259 | 271 | AC_OUTPUT([ |
|---|
| r0268e62 |
r2c65def |
|
| 39 | 39 | #undef MODULEEXT |
|---|
| 40 | 40 | #undef MODULES_DIR |
|---|
| | 41 | #undef ETC_DIR |
|---|
| 41 | 42 | |
|---|
| 42 | 43 | #undef HAVE_FCNTL_H |
|---|
| r0268e62 |
r2c65def |
|
| 3 | 3 | #include <stdio.h> |
|---|
| 4 | 4 | #include <stdlib.h> |
|---|
| | 5 | #include <unistd.h> |
|---|
| 5 | 6 | #include <errno.h> |
|---|
| 6 | 7 | #include <sys/ioctl.h> |
|---|
| 7 | 8 | #include <fcntl.h> |
|---|
| 8 | 9 | |
|---|
| | 10 | #include "getopt_long.h" |
|---|
| 9 | 11 | #include "eventer/eventer.h" |
|---|
| 10 | 12 | #include "utils/noit_log.h" |
|---|
| 11 | 13 | #include "noit_listener.h" |
|---|
| 12 | 14 | #include "noit_console.h" |
|---|
| | 15 | #include "noit_conf.h" |
|---|
| | 16 | |
|---|
| | 17 | static char *config_file = ETC_DIR "/noit.conf"; |
|---|
| | 18 | static int debug = 0; |
|---|
| | 19 | |
|---|
| | 20 | void parse_clargs(int argc, char **argv) { |
|---|
| | 21 | int c; |
|---|
| | 22 | while((c = getopt(argc, argv, "c:d")) != EOF) { |
|---|
| | 23 | switch(c) { |
|---|
| | 24 | case 'c': |
|---|
| | 25 | config_file = strdup(optarg); |
|---|
| | 26 | break; |
|---|
| | 27 | case 'd': |
|---|
| | 28 | debug++; |
|---|
| | 29 | break; |
|---|
| | 30 | default: |
|---|
| | 31 | break; |
|---|
| | 32 | } |
|---|
| | 33 | } |
|---|
| | 34 | } |
|---|
| 13 | 35 | |
|---|
| 14 | 36 | int main(int argc, char **argv) { |
|---|
| | 37 | parse_clargs(argc, argv); |
|---|
| 15 | 38 | |
|---|
| 16 | 39 | noit_log_init(); |
|---|
| 17 | | noit_log_stream_add_stream(noit_debug, noit_stderr); |
|---|
| | 40 | if(debug) |
|---|
| | 41 | noit_log_stream_add_stream(noit_debug, noit_stderr); |
|---|
| 18 | 42 | noit_log_stream_add_stream(noit_error, noit_stderr); |
|---|
| 19 | 43 | |
|---|
| 20 | 44 | noit_conf_init(); |
|---|
| 21 | | |
|---|
| | 45 | if(noit_conf_load(config_file) == -1) { |
|---|
| | 46 | fprintf(stderr, "Cannot load config: '%s'\n", config_file); |
|---|
| | 47 | } |
|---|
| 22 | 48 | if(eventer_choose("kqueue") == -1) { |
|---|
| 23 | 49 | fprintf(stderr, "Cannot choose kqueue\n"); |
|---|