diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-09-20 19:12:50 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-09-20 19:12:50 +0200 |
commit | 7bc63588efa1f59e7f8c21721af9557e9e59f44f (patch) | |
tree | c0aa39480d723166c9c4b0843026e373660dbcc5 /src/misc.h | |
parent | cccd5ac6d99fd7fb56f5940ffb0e901e015dacb8 (diff) | |
download | bbs-7bc63588efa1f59e7f8c21721af9557e9e59f44f.tar.gz |
moved telnet, modem to seperate files
Diffstat (limited to 'src/misc.h')
-rw-r--r-- | src/misc.h | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -12,6 +12,45 @@ #include <stdio.h> #include <errno.h> #include <string.h> +#include <stdint.h> + +#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 + +#define ERROR_HELP( ... ) { \ + printf(__VA_ARGS__); \ + printf("bbs\n-p PORT: telnet port\n-i IP: telnet listen ip\n-s DEVIVE: modem serial device\n-b BAUD: serial baudrate\n-f FILE: use pidfile\n"); \ + exit(1); } + +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; + uint32_t serial_baudrate; + + uint8_t fork; + char* pidfile; +}; + +struct prog_params parse_args(int argc, char* argv[]); /* * Try writing to _fd for _retry times. Retries are reset after every succesful write. |