#include #include #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); //write to log that some user have accesed bbs //bbs_log( NULL ); //write to default place bbs_login_motd( &ts, "art/motd.txt" ); print_build_info(); while ( strncmp( str, "q", 1 ) && strncmp( str, "Q", 1 ) ) { printf("(M)otd (Q)uit (S)ysinfo (A)rticles: "); ret_len = getline( &str, &str_size, stdin ); if ( ret_len > 0) { switch ( str[0] ) { case 'm': case 'M': { bbs_login_motd( &ts, "art/motd.txt" ); } break; case 's': case 'S': { bbs_sysinfo( &ts ); } break; case 'a': case 'A': { bbs_article_list( &ts, "./article/" ); } break; case 'q': case 'Q': bbs_log_quit( NULL ); break; default: printf("Unknow command\n"); } } } bbs_quit_motd( &ts, "art/quit.txt" ); return 0; }