Changeset 2c65def60e6630d515d47a2135e89e7961c4c5b9

Show
Ignore:
Timestamp:
01/26/08 04:20:28 (7 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
  • configure.in

    r0268e62 r2c65def  
    256256AC_SUBST(MODULES_DIR) 
    257257 
     258AC_MSG_CHECKING([Resolving sysconfdir path...]) 
     259fullpath=$sysconfdir 
     260while test "x$temppath" != "x$fullpath" ; do 
     261  temppath=$fullpath 
     262  fullpath=`eval echo ${fullpath}` 
     263done 
     264fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"` 
     265AC_MSG_RESULT([$fullpath]) 
     266AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}") 
     267ETC_DIR=${fullpath} 
     268AC_SUBST(ETC_DIR) 
     269 
    258270 
    259271AC_OUTPUT([ 
  • src/noit_config.h.in

    r0268e62 r2c65def  
    3939#undef MODULEEXT 
    4040#undef MODULES_DIR 
     41#undef ETC_DIR 
    4142 
    4243#undef HAVE_FCNTL_H 
  • src/noitd.c

    r0268e62 r2c65def  
    33#include <stdio.h> 
    44#include <stdlib.h> 
     5#include <unistd.h> 
    56#include <errno.h> 
    67#include <sys/ioctl.h> 
    78#include <fcntl.h> 
    89 
     10#include "getopt_long.h" 
    911#include "eventer/eventer.h" 
    1012#include "utils/noit_log.h" 
    1113#include "noit_listener.h" 
    1214#include "noit_console.h" 
     15#include "noit_conf.h" 
     16 
     17static char *config_file = ETC_DIR "/noit.conf"; 
     18static int debug = 0; 
     19 
     20void 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} 
    1335 
    1436int main(int argc, char **argv) { 
     37  parse_clargs(argc, argv); 
    1538 
    1639  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); 
    1842  noit_log_stream_add_stream(noit_error, noit_stderr); 
    1943 
    2044  noit_conf_init(); 
    21  
     45  if(noit_conf_load(config_file) == -1) { 
     46    fprintf(stderr, "Cannot load config: '%s'\n", config_file); 
     47  } 
    2248  if(eventer_choose("kqueue") == -1) { 
    2349    fprintf(stderr, "Cannot choose kqueue\n");