diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-03-25 00:19:19 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-03-25 00:19:19 +0800 |
commit | 64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa (patch) | |
tree | dcdfd6afd0aa122d7ac150255341e26c866ffca1 | |
parent | ea76d3be14e2c2fa1431b2015781c6bd2a3bd75d (diff) | |
download | pttbbs-64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa.tar pttbbs-64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa.tar.gz pttbbs-64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa.tar.bz2 pttbbs-64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa.tar.lz pttbbs-64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa.tar.xz pttbbs-64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa.tar.zst pttbbs-64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa.zip |
shmctl
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@62 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | util/.cvsignore | 3 | ||||
-rw-r--r-- | util/shmctl.c | 23 |
2 files changed, 20 insertions, 6 deletions
diff --git a/util/.cvsignore b/util/.cvsignore index e7408563..73de8aac 100644 --- a/util/.cvsignore +++ b/util/.cvsignore @@ -39,4 +39,5 @@ toplazyBBM toplazyBM jungo bbsctl -daymandex +mandex +shmctl
\ No newline at end of file diff --git a/util/shmctl.c b/util/shmctl.c index e28a971c..f8698398 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -12,7 +12,7 @@ extern struct utmpfile_t *utmpshm; -int fixutmp(int argc, char **argv) +int utmpfix(int argc, char **argv) { int i; char buf[1024], *clean; @@ -43,10 +43,23 @@ int fixutmp(int argc, char **argv) return 0; } +char *CTIME(char *buf, time_t t) +{ + strcpy(buf, ctime(&t)); + buf[strlen(buf) - 1] = 0; + return buf; +} + int utmpstate(int argc, char **argv) { + time_t now; + char upbuf[64], nowbuf[64]; + now = time(NULL); + CTIME(upbuf, utmpshm->uptime); + CTIME(nowbuf, time(NULL)); + printf("now: %s\n", nowbuf); printf("currsorted: %d\n", utmpshm->currsorted); - printf("uptime: %s", ctime(&utmpshm->uptime)); + printf("uptime: %s\n", upbuf); printf("number: %d\n", utmpshm->number); printf("busystate: %d\n", utmpshm->busystate); return 0; @@ -156,10 +169,10 @@ struct { int (*func)(int, char **); char *cmd, *descript; } cmd[] = - { {fixutmp, "fixutmp", "clear dead userlist entry"}, + { {utmpfix, "utmpfix", "clear dead userlist entry"}, {utmpstate, "utmpstate", "list utmpstate"}, - {utmpreset, "resetutmp", "utmpshm->busystate=0"}, - {utmpsort, "ulistsort", "sort ulist"}, + {utmpreset, "utmpreset", "utmpshm->busystate=0"}, + {utmpsort, "utmpsort", "sort ulist"}, {NULL, NULL, NULL} }; int main(int argc, char **argv) |