summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Kconfig3
-rw-r--r--articles.c4
-rw-r--r--articles.h2
-rw-r--r--bbsconfig.c16
-rw-r--r--bbsconfig.h1
-rw-r--r--config/default.ini6
-rw-r--r--door.c9
-rw-r--r--file_use.h1
-rw-r--r--microbbs.c9
-rw-r--r--statistics.h5
10 files changed, 43 insertions, 13 deletions
diff --git a/Kconfig b/Kconfig
index 157b524..3b73372 100644
--- a/Kconfig
+++ b/Kconfig
@@ -56,6 +56,9 @@ menuconfig ARTICLES
default y
if ARTICLES
+ config ARTICLES_DEFAULT_DIR
+ string "Default article directory"
+ default "./articles/"
endif
menuconfig MOTD
diff --git a/articles.c b/articles.c
index 08f115a..3358b47 100644
--- a/articles.c
+++ b/articles.c
@@ -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;
}
diff --git a/articles.h b/articles.h
index a0ad530..1467fad 100644
--- a/articles.h
+++ b/articles.h
@@ -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
diff --git a/door.c b/door.c
index 82a7538..4c6fc06 100644
--- a/door.c
+++ b/door.c
@@ -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 );
}
diff --git a/file_use.h b/file_use.h
index 6aa11da..8b0ac66 100644
--- a/file_use.h
+++ b/file_use.h
@@ -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
diff --git a/microbbs.c b/microbbs.c
index 5024b8b..08f65c8 100644
--- a/microbbs.c
+++ b/microbbs.c
@@ -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