summaryrefslogtreecommitdiff
path: root/microbbs.c
blob: af2295845f625163c1ff157c74c70b44c199a6b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
}