diff options
| -rw-r--r-- | Kconfig | 3 | ||||
| -rw-r--r-- | articles.c | 4 | ||||
| -rw-r--r-- | articles.h | 2 | ||||
| -rw-r--r-- | bbsconfig.c | 16 | ||||
| -rw-r--r-- | bbsconfig.h | 1 | ||||
| -rw-r--r-- | config/default.ini | 6 | ||||
| -rw-r--r-- | door.c | 9 | ||||
| -rw-r--r-- | file_use.h | 1 | ||||
| -rw-r--r-- | microbbs.c | 9 | ||||
| -rw-r--r-- | statistics.h | 5 | 
10 files changed, 43 insertions, 13 deletions
@@ -56,6 +56,9 @@ menuconfig ARTICLES  	default y  if ARTICLES +	config ARTICLES_DEFAULT_DIR +	string "Default article directory" +	default "./articles/"  endif  menuconfig MOTD @@ -164,6 +164,10 @@ int bbs_article_list( term_screen *ts, const char *dir_name )  			ERROR("Cannot open article directory\n");  		}  		ret = 0; +	} else +	{ +		ERROR("No directory specified\n"); +		return ret;  	} @@ -31,8 +31,6 @@  //part of libadt  #include "list.h" -#define WORKING_DIR "article" -  int bbs_article( term_screen*, const char* );  int bbs_article_list( term_screen*, const char* ); diff --git a/bbsconfig.c b/bbsconfig.c index 4eed4a6..6dea7dc 100644 --- a/bbsconfig.c +++ b/bbsconfig.c @@ -8,7 +8,11 @@ int config_default()  	//g_config.todo_files = llist_new();  	g_config.todo_files = NULL; +#ifdef CONFIG_ARTICLES +	g_config.article_dir = CONFIG_ARTICLES_DEFAULT_DIR; +#else  	g_config.article_dir = NULL; +#endif  #ifdef CONFIG_LOGIN  	g_config.user_dir = CONFIG_USER_DEFAULT_DIR; @@ -33,6 +37,9 @@ userdir string  syslog int  */ +/* +bbs_cfg_handler - callback for parsing ini file and obtain values +*/  static int bbs_cfg_handler( void *user, const char *section, const char *name,                                const char *value )  { @@ -145,4 +152,13 @@ int config_from_argv( int argc, char **argv )  	return ret;  } +char* config_to_str( size_t max_size ) +{ +	char *str = malloc( max_size ); +	if (str == NULL) +		return NULL; + + +	return str; +} diff --git a/bbsconfig.h b/bbsconfig.h index e676b74..3819d9d 100644 --- a/bbsconfig.h +++ b/bbsconfig.h @@ -58,6 +58,7 @@ extern bbs_config g_config;  int config_default();  int config_from_ini( const char *config_file );  int config_from_argv( int argc, char **argv ); +char* config_to_str( size_t max_size );  #endif
\ No newline at end of file diff --git a/config/default.ini b/config/default.ini new file mode 100644 index 0000000..0fedc68 --- /dev/null +++ b/config/default.ini @@ -0,0 +1,6 @@ +[bbs] +rootdir=/usr/bin +tododir=/www/srv/telnet/todo +articledir=/www/srv/telnet/article +userdir=/www/srv/telnet/users +syslog=1 @@ -17,18 +17,10 @@ int bbs_door_start( term_screen *ts, const char *cmd )  	int restore_mode=1; -	//struct termios orig_i; -	//struct termios orig_o; -  	term_clr_scr( ts ); -	//if ( tcgetattr( ts->ifd, &orig_i ) == -1 ) restore_mode = 0; -	//if ( tcgetattr( ts->ofd, &orig_o ) == -1 ) restore_mode = 0; -  	tcsetattr( ts->ifd, TCSAFLUSH, &ts->orig_i ); -	//tcsetattr( ts->ofd, TCSAFLUSH, &ts->orig_o ); -	//term_clr_scr( ts );  	if ( system( cmd ) == -1 )  	{  		bbs_log( "DOOR", "couldnt execute doorgame"); @@ -37,7 +29,6 @@ int bbs_door_start( term_screen *ts, const char *cmd )  	if ( restore_mode )  	{  		tcsetattr( ts->ifd, TCSAFLUSH, &ts->raw_i ); -		//tcsetattr( ts->ofd, TCSAFLUSH, &orig_o );  	} @@ -12,6 +12,7 @@  #define F_FILE_WRITE 2  #define F_FILE_RW    3 +  #define F_SEEK_CUR SEEK_CUR  #define F_SEEK_END SEEK_END  #define F_SEEK_SET SEEK_SET @@ -14,6 +14,7 @@  #include "twit.h"  #include "todo.h"  #include "door.h" +#include "captcha.h"  #include "libterm/term.h"  #include "libterm/term_io.h" @@ -28,6 +29,10 @@ int main( int argc, char **argv )  	int main_menu_input=0;  	char main_menu_cmd; +	//set default config values +	config_default(); + +	//setting up terminal  	term_screen ts; memset( (void *)&ts, 0, sizeof(ts) );  	term_init( &ts );  	term_set_raw_mode( &ts ); @@ -41,7 +46,7 @@ int main( int argc, char **argv )  	//lunch captcha and try to detect if its random bot  #ifdef CONFIG_CAPTCHA -	if ( captcha_test1( ts ) != 1) +	if ( captcha_test1( &ts ) != 1)  	{  		goto exit_restore_terminal;  	} @@ -142,7 +147,7 @@ int main( int argc, char **argv )  			case 'a':  			case 'A':  				{ -					bbs_article_list( &ts, "./article/" ); +					bbs_article_list( &ts, g_config.article_dir );  				}  				break;  		#endif diff --git a/statistics.h b/statistics.h index a91e988..b4cfc5d 100644 --- a/statistics.h +++ b/statistics.h @@ -1,4 +1,9 @@  #ifndef __MICROBBS_STATISTICS_H  #define __MICROBBS_STATISTICS_H +typedef struct bbs_stats +{ +	 +} bbs_stats; +  #endif
\ No newline at end of file  | 
