summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--util/.cvsignore3
-rw-r--r--util/shmctl.c23
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)