From 7a794483c75fa6590958dda5ceaf5fb4438c3066 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Mon, 29 Dec 2014 11:17:49 +0900 Subject: Small fixes, not change any functionality --- Kconfig | 11 +++++++++++ Makefile | 2 +- file_use.c | 14 +++++++------- microbbs.c | 11 ++++++++++- todo.c | 8 ++++++-- vote.c | 2 +- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Kconfig b/Kconfig index 3e5af48..3dd7275 100644 --- a/Kconfig +++ b/Kconfig @@ -1,8 +1,12 @@ menuconfig TODO bool "List of todo" option todo + default y if TODO + config TODO_DEFAULT_FILE + string "Default file location" + default "todo/todo.txt" endif menuconfig TWIT @@ -53,7 +57,14 @@ menuconfig MOTD if MOTD endif +menuconfig MESSAGING + bool "Messaging between users" + option messaging + default n + +if MESSAGING +endif config CAPTCHA bool "Enable simple captcha" diff --git a/Makefile b/Makefile index 1ee8390..46d2144 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PROJECT=microbbs CC=gcc CFLAGS= -SOURCES=articles.c bbsconfig.c buildinfo.c captcha.c file_use.c ini.c list.c login.c logs.c mmm.c motd.c session.c statistics.c sysinfo.c telnetd.c textview.c vote.c +SOURCES=articles.c bbsconfig.c buildinfo.c captcha.c file_use.c ini.c list.c login.c logs.c mmm.c motd.c sds.c session.c statistics.c sysinfo.c telnetd.c textview.c todo.c vote.c OBJECTS=$(SOURCES:.c=.o) BUILD_DIR=build_dir diff --git a/file_use.c b/file_use.c index 3aae696..0cfa823 100644 --- a/file_use.c +++ b/file_use.c @@ -18,7 +18,7 @@ void f_file_null( f_file *f_f ) int f_file_seek( f_file *f_f, long offset, int seek ) { int ret=-1; - PRINT("\n"); + //PRINT("\n"); if ( f_f ) { if ( offset < 0 ) @@ -55,7 +55,7 @@ size_t f_file_read( f_file *f_f, size_t size, void *ptr ) { size_t ret=-1; - PRINT("\n"); + //PRINT("\n"); if ( f_f ) { if ( (f_f->flags == F_FILE_READ) || @@ -98,7 +98,7 @@ size_t f_file_readl( f_file *f_f, size_t size, void *ptr ) { size_t ret=-1; - PRINT("\n"); + //PRINT("\n"); if ( f_f ) { int c=0; @@ -127,7 +127,7 @@ int f_file_size( f_file *f_f ) int ret=-1; long old_seek; - PRINT("\n"); + //PRINT("\n"); if ( f_f ) { //could make some logic break @@ -149,7 +149,7 @@ int f_file_size( f_file *f_f ) //--------------------------------------------------------------------- size_t f_file_write( f_file *f_f, size_t size, void *ptr ) { - PRINT("\n"); + //PRINT("\n"); if ( f_f ) { if ((f_f->flags == F_FILE_WRITE) || @@ -175,7 +175,7 @@ f_file* f_file_open( const char *fname, int flags ) char *f_flags_rw="r+"; char *f_flags_tmp=NULL; - PRINT("\n"); + //PRINT("\n"); if ( fname != NULL ) { ret = malloc( sizeof( f_file ) ); @@ -228,7 +228,7 @@ exit_close_f: //--------------------------------------------------------------------- int f_file_close( f_file *f_f ) { - PRINT("\n"); + //PRINT("\n"); if ( f_f ) { fclose( f_f->fid ); diff --git a/microbbs.c b/microbbs.c index c414b55..cf3a7db 100644 --- a/microbbs.c +++ b/microbbs.c @@ -6,6 +6,8 @@ #include "motd.h" #include "libterm/term.h" +#include "ini.h" + int main( int argc, char **argv ) { int ret_len; @@ -60,7 +62,12 @@ int main( int argc, char **argv ) #ifdef CONFIG_TODO printf("T(o)do "); #endif - printf("(Q)uit (S)ysinfo Mesa(G)es: "); + + #ifdef CONFIG_MESSAGING + printf("Mesa(G)es "); + #endif + + printf("(Q)uit (S)ysinfo: "); ret_len = getline( &str, &str_size, stdin ); if ( ret_len > 0) { @@ -112,12 +119,14 @@ int main( int argc, char **argv ) break; #endif + #ifndef CONFIG_MESSAGING case 'g': case 'G': { printf("Messages\n"); } break; + #endif //------------------------------------------------------------------ #ifdef CONFIG_BOARD diff --git a/todo.c b/todo.c index a505123..ce42633 100644 --- a/todo.c +++ b/todo.c @@ -16,6 +16,7 @@ int bbs_todo( term_screen *ts, const char *fname) if ( fname == NULL ) fname = CONFIG_TODO_DEFAULT_FILE; + //LOAD DATA FROM FILE TO LINKED LIST List *todo_list = llist_new(); f_file *file = f_file_open( fname, F_FILE_READ ); if ( file != NULL ) @@ -35,11 +36,14 @@ int bbs_todo( term_screen *ts, const char *fname) } f_file_close( file ); + //LOAD DATA FROM FILE TO LINKED LIST + //END + while( (quit_loop == 0) ) { - printf("(S)how tood list,(Q)uit:"); + printf("(S)how todo list,(Q)uit:"); ret_len = getline( &in_buf, &in_size, stdin ); if ( ret_len > 0 ) { @@ -59,7 +63,7 @@ int bbs_todo( term_screen *ts, const char *fname) int cnt = 1; while (iter != NULL) { - printf( "[%d] -> %s\n", cnt, (char *)iter->val); + printf( "[%02d] -> %s\n", cnt, (char *)iter->val); cnt += 1; iter = iter->next; } diff --git a/vote.c b/vote.c index 9ded5cb..27cdf9b 100644 --- a/vote.c +++ b/vote.c @@ -2,7 +2,7 @@ int bbs_vote( term_screen *ts, const char *s ) { - int ret=-1; + int ret = -1; -- cgit v1.2.3