diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/Makefile | 4 | ||||
-rw-r--r-- | mbbsd/cal.c | 33 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 4 | ||||
-rw-r--r-- | mbbsd/var.c | 3 |
4 files changed, 26 insertions, 18 deletions
diff --git a/mbbsd/Makefile b/mbbsd/Makefile index 54882a35..5d9d4f2b 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.11 2002/06/26 19:38:16 kcwu Exp $ +# $Id: Makefile,v 1.12 2002/07/05 13:18:27 in2 Exp $ BBSHOME?=$(HOME) OSTYPE=FreeBSD @@ -34,6 +34,8 @@ LDFLAGS+= -DDEBUG CFLAGS+= -DNO_FORK .endif +CFLAGS+= "-DCOMPILE_TIME=\"`date`\"" + CC= gcc PROG= mbbsd OBJS= admin.o announce.o args.o bbs.o board.o cache.o cal.o card.o\ diff --git a/mbbsd/cal.c b/mbbsd/cal.c index dbb90c71..995f4c55 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -1,4 +1,4 @@ -/* $Id: cal.c,v 1.14 2002/06/06 21:34:11 in2 Exp $ */ +/* $Id: cal.c,v 1.15 2002/07/05 13:14:14 in2 Exp $ */ #include "bbs.h" /* 防堵 Multi play */ @@ -375,21 +375,24 @@ int p_give() { return 0; } -int p_sysinfo() { - char buf[100]; - long int total,used; - float p; - - move(b_lines-1,0); - clrtoeol(); - cpuload(buf); - outs("CPU 負荷 : "); - outs(buf); +int p_sysinfo(void) +{ + char buf[128], *cpuloadstr; + int load; + + load = cpuload(buf); + cpuloadstr = (load < 5 ? "良好" : (load < 20 ? "尚可" : "過重")); - p = swapused(&total,&used); - sprintf(buf, " 虛擬記憶體: %.1f%%(全部:%ldMB 用掉:%ldMB)\n", - p*100, total >> 20, used >> 20); - outs(buf); + clear(); + showtitle("系統資訊", BBSNAME); + move(2, 0); + prints("您現在位於 " TITLE_COLOR BBSNAME "\033[m (" MYIP ")\n" + "系統負載情況: %s\n" + "線上服務人數: %d/%d\n" + "編譯時間: %s\n" + "起始時間: %s\n", + cpuloadstr, SHM->UTMPnumber, + MAX_ACTIVE, COMPILE_TIME, ctime(&start_time)); pressanykey(); return 0; } diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 9309668d..5109474d 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1,4 +1,4 @@ -/* $Id: mbbsd.c,v 1.38 2002/07/04 20:08:11 in2 Exp $ */ +/* $Id: mbbsd.c,v 1.39 2002/07/05 13:14:14 in2 Exp $ */ #include "bbs.h" #define SOCKET_QLEN 4 @@ -1174,6 +1174,8 @@ static int check_ban_and_load (int fd); int main (int argc, char *argv[], char *envp[]) { + start_time = time(NULL); + /* avoid SIGPIPE */ signal (SIGPIPE, SIG_IGN); diff --git a/mbbsd/var.c b/mbbsd/var.c index 4fe601b1..fe778782 100644 --- a/mbbsd/var.c +++ b/mbbsd/var.c @@ -1,4 +1,4 @@ -/* $Id: var.c,v 1.8 2002/06/19 13:32:23 lwms Exp $ */ +/* $Id: var.c,v 1.9 2002/07/05 13:14:14 in2 Exp $ */ #define INCLUDE_VAR_H #include "bbs.h" @@ -93,6 +93,7 @@ char reset_color[4] = "\033[m"; char margs[64] = "\0"; /* main argv list*/ pid_t currpid; /* current process ID */ time_t login_start_time; +time_t start_time; time_t paste_time; userec_t cuser; /* current user structure */ userec_t xuser; /* lookup user structure */ |