From ae108d4500ac2b179462e0f33587a1e53e50e8a3 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Sat, 18 May 2019 17:41:36 +0200 Subject: seperated main --- .gitignore | 1 + src/main.c | 45 +-------------------------------------------- src/main.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 44 deletions(-) create mode 100644 src/main.h diff --git a/.gitignore b/.gitignore index b1a9d70..7a75f37 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.o obj/ build/ +tags diff --git a/src/main.c b/src/main.c index b2dbbe7..f583d63 100644 --- a/src/main.c +++ b/src/main.c @@ -1,47 +1,4 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _DEF_MAX_BACKLOG 20 -#define _DEF_PORT 23 -#define _DEF_IP 0 -#define _DEF_CONFIG_FILE "/etc/bbs.conf" - -#ifdef _DEBUG -//DEBUG Macros -#warning "Compiling in DEBUG mode" -#define DEBUG_PRINTF( ... ) { \ - printf("%s:%d: ", __FILE__, __LINE__); \ - printf(__VA_ARGS__ ); } -#define PRINT_ERROR( str ) { \ - printf("%s:%d: %s: %s\n", __FILE__, __LINE__, str, strerror(errno)); } -#else -//Release Macros -#define DEBUG_PRINTF( ... ) { } -#define PRINT_ERROR( str ) { printf("%s: %s\n", str, strerror(errno)); } -#endif - -struct prog_params -{ - uint8_t telnet; - uint16_t port; - uint16_t backlog; - char* ip; - char** run_argv; - int run_argc; - - uint8_t serial; - char* serial_port; -}; +#include "main.h" struct prog_params parse_args(int argc, char* argv[]) { diff --git a/src/main.h b/src/main.h new file mode 100644 index 0000000..6f84d85 --- /dev/null +++ b/src/main.h @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define _DEF_MAX_BACKLOG 20 +#define _DEF_PORT 23 +#define _DEF_IP 0 +#define _DEF_CONFIG_FILE "/etc/bbs.conf" + +#ifdef _DEBUG +//DEBUG Macros +#warning "Compiling in DEBUG mode" +#define DEBUG_PRINTF( ... ) { \ + printf("%s:%d: ", __FILE__, __LINE__); \ + printf(__VA_ARGS__ ); } +#define PRINT_ERROR( str ) { \ + printf("%s:%d: %s: %s\n", __FILE__, __LINE__, str, strerror(errno)); } +#else +//Release Macros +#define DEBUG_PRINTF( ... ) { } +#define PRINT_ERROR( str ) { printf("%s: %s\n", str, strerror(errno)); } +#endif + +struct prog_params +{ + uint8_t telnet; + uint16_t port; + uint16_t backlog; + char* ip; + char** run_argv; + int run_argc; + + uint8_t serial; + char* serial_port; +}; + +struct prog_params parse_args(int argc, char* argv[]); + +void handle_connection(int _socket, struct sockaddr_in _addr); + +int main(int argc, char* argv[]); -- cgit v1.2.3