From bf4ad5624a890a3f3b6936f04ac3765e9ec2fecb Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Thu, 6 Jan 2011 12:25:44 +0100 Subject: [PATCH] Visual Studio compile fixes. --- src/core/main.c | 7 +++---- src/core/pluginloader.h | 8 -------- src/plugins/mod_auth_simple.c | 11 +++++++---- src/system.h | 1 + src/uhub.h | 1 + 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/core/main.c b/src/core/main.c index 41c631d..f270b8f 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1,6 +1,6 @@ /* * uhub - A tiny ADC p2p connection hub - * Copyright (C) 2007-2009, Jan Vidar Krey + * Copyright (C) 2007-2011, Jan Vidar Krey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,6 @@ #include "uhub.h" - static int arg_verbose = 5; static int arg_fork = 0; static int arg_check_config = 0; @@ -145,6 +144,8 @@ int main_loop() hub_set_variables(hub, &acl); + break; + hub_event_loop(hub); hub_free_variables(hub); @@ -231,7 +232,6 @@ void print_usage(char* program) void parse_command_line(int argc, char** argv) { -#ifdef HAVE_GETOPT int opt; while ((opt = getopt(argc, argv, "vqfc:l:hu:g:VCsSLp:")) != -1) { @@ -302,7 +302,6 @@ void parse_command_line(int argc, char** argv) break; } } -#endif /* HAVE_GETOPT */ if (arg_config == NULL) { diff --git a/src/core/pluginloader.h b/src/core/pluginloader.h index cf5206e..33b5cc4 100644 --- a/src/core/pluginloader.h +++ b/src/core/pluginloader.h @@ -22,17 +22,13 @@ #include "plugin_api/handle.h" -#ifdef PLUGIN_SUPPORT - struct hub_config; struct linked_list; struct plugin_handle; struct uhub_plugin { -#ifdef HAVE_DLOPEN void* handle; -#endif plugin_unregister_f unregister; }; @@ -54,9 +50,5 @@ extern struct uhub_plugin* plugin_open(const char* filename); extern void plugin_close(struct uhub_plugin*); extern void* plugin_lookup_symbol(struct uhub_plugin*, const char* symbol); - - -#endif /* PLUGIN_SUPPORT */ - #endif /* HAVE_UHUB_PLUGIN_LOADER_H */ diff --git a/src/plugins/mod_auth_simple.c b/src/plugins/mod_auth_simple.c index 5610be6..f5b712d 100644 --- a/src/plugins/mod_auth_simple.c +++ b/src/plugins/mod_auth_simple.c @@ -1,6 +1,6 @@ /* * uhub - A tiny ADC p2p connection hub - * Copyright (C) 2010, Jan Vidar Krey + * Copyright (C) 2011, Jan Vidar Krey */ #include "plugin_api/handle.h" @@ -101,6 +101,9 @@ static int parse_line(char* line, int line_count, void* ptr_data) struct linked_list* users = (struct linked_list*) ptr_data; struct cfg_tokens* tokens = cfg_tokenize(line); enum auth_credentials cred; + char* credential; + char* username; + char* password; if (cfg_token_count(tokens) == 0) { @@ -114,9 +117,9 @@ static int parse_line(char* line, int line_count, void* ptr_data) return -1; } - char* credential = cfg_token_get_first(tokens); - char* username = cfg_token_get_next(tokens); - char* password = cfg_token_get_next(tokens); + credential = cfg_token_get_first(tokens); + username = cfg_token_get_next(tokens); + password = cfg_token_get_next(tokens); if (!auth_string_to_cred(credential, &cred)) { diff --git a/src/system.h b/src/system.h index 17aa181..38cb5ef 100644 --- a/src/system.h +++ b/src/system.h @@ -250,6 +250,7 @@ typedef unsigned __int64 uint64_t; #define open _open #define close _close #define read _read +#define NEED_GETOPT #endif #endif /* HAVE_UHUB_SYSTEM_H */ diff --git a/src/uhub.h b/src/uhub.h index 1cc107b..44dcba4 100644 --- a/src/uhub.h +++ b/src/uhub.h @@ -63,6 +63,7 @@ extern "C" { #include "util/config_token.h" #include "util/credentials.h" #include "util/floodctl.h" +#include "util/getopt.h" #include "util/ipcalc.h" #include "util/list.h" #include "util/log.h"