summaryrefslogtreecommitdiff
path: root/microbbs.c
diff options
context:
space:
mode:
Diffstat (limited to 'microbbs.c')
-rw-r--r--microbbs.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/microbbs.c b/microbbs.c
new file mode 100644
index 0000000..af22958
--- /dev/null
+++ b/microbbs.c
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <stdlib.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);
+
+ bbs_motd( &ts, "art/motd.txt" );
+ print_build_info();
+ while ( 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':
+ {
+ bbs_motd( &ts, "art/motd.txt" );
+ }
+ break;
+ case 's':
+ {
+ bbs_sysinfo( &ts );
+ }
+ break;
+ case 'a':
+ {
+ bbs_article( &ts, "article/post1.txt" );
+ }
+ break;
+ case 'q':
+ break;
+ default:
+ printf("Unknow command\n");
+ }
+ }
+ }
+ return 0;
+}