summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-05 21:18:29 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-07-05 21:18:29 +0800
commit10bda3e57cad194ac33ccdcd01aee2d935f1544a (patch)
tree1c441cedd5a8daaa40c3360b143bcbdf13a4a4c5 /mbbsd
parent4b6c46542ff1ef1a068a8ae33c07165a3d27df5d (diff)
downloadpttbbs-10bda3e57cad194ac33ccdcd01aee2d935f1544a.tar
pttbbs-10bda3e57cad194ac33ccdcd01aee2d935f1544a.tar.gz
pttbbs-10bda3e57cad194ac33ccdcd01aee2d935f1544a.tar.bz2
pttbbs-10bda3e57cad194ac33ccdcd01aee2d935f1544a.tar.lz
pttbbs-10bda3e57cad194ac33ccdcd01aee2d935f1544a.tar.xz
pttbbs-10bda3e57cad194ac33ccdcd01aee2d935f1544a.tar.zst
pttbbs-10bda3e57cad194ac33ccdcd01aee2d935f1544a.zip
sysinfo
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@414 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/Makefile4
-rw-r--r--mbbsd/cal.c33
-rw-r--r--mbbsd/mbbsd.c4
-rw-r--r--mbbsd/var.c3
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 */