#include #include #include "kconfig.h" #include "logs.h" #include "motd.h" #include "libterm/term.h" int main( int argc, char **argv ) { int ret_len; size_t str_size=128; char *str=malloc(str_size); term_screen ts; term_init_data( &ts ); //printf("%d %d\n", ts.term_col, ts.term_row); //lunch captcha and try to detect if its random bot #ifdef CONFIG_CAPTCHA if ( captcha_test1() != 1) return 1; #endif //write to log that some user have accesed bbs //too much fake stuff comes to log //bbs_log( NULL ); //write to default place #ifdef CONFIG_MOTD bbs_login_motd( &ts, "art/motd.txt" ); print_build_info(); #endif while ( strncmp( str, "q", 1 ) && strncmp( str, "Q", 1 ) ) { #ifdef CONFIG_MOTD printf("(M)otd "); #endif #ifdef CONFIG_ARTICLES printf("(A)rticles "); #endif #ifdef CONFIG_DOORGAMES printf("(D)oor games "); #endif #ifdef CONFIG_TWIT printf("(T)wit "); #endif #ifdef CONFIG_BOARD printf("(B)oard "); #endif #ifdef CONFIG_LOGIN printf("(L)ogin "); #endif #ifdef CONFIG_TODO printf("T(o)do "); #endif printf("(Q)uit (S)ysinfo Mesa(G)es: "); ret_len = getline( &str, &str_size, stdin ); if ( ret_len > 0) { switch ( str[0] ) { //------------------------------------------------------------------ #ifdef CONFIG_MOTD case 'm': case 'M': { bbs_login_motd( &ts, "art/motd.txt" ); } break; #endif case 's': case 'S': { bbs_sysinfo( &ts ); } break; //------------------------------------------------------------------ #ifdef CONFIG_ARTICLES case 'a': case 'A': { bbs_article_list( &ts, "./article/" ); } break; #endif //------------------------------------------------------------------ #ifdef CONFIG_TWIT case 't': case 'T': { printf("Twitter like\n"); } break; #endif //------------------------------------------------------------------ #ifdef CONFIG_DOORGAMES case 'd': case 'D': { printf("Door games\n"); } break; #endif case 'g': case 'G': { printf("Messages\n"); } break; //------------------------------------------------------------------ #ifdef CONFIG_BOARD case 'b': case 'B': { printf("Board\n"); } break; #endif //------------------------------------------------------------------ #ifdef CONFIG_LOGIN case 'l': case 'L': { printf("Login?\n"); } break; #endif //------------------------------------------------------------------ #ifdef CONFIG_TODO case 'o': case 'O': { printf("Todo list\n"); bbs_todo( &ts, NULL ); } break; #endif case 'q': case 'Q': bbs_log_quit( NULL ); break; default: printf("Unknow command\n"); } } } #ifdef CONFIG_MOTD bbs_quit_motd( &ts, "art/quit.txt" ); #endif return 0; }