Skip to content
Permalink
Browse files

Added missing directoriesFixed bug with motd countAdded -a switch to …

…system command to list all system information at once
  • Loading branch information...
amnuts committed Sep 6, 2011
1 parent ff0ce92 commit 99a4e82616160c57577829059aeb39f53e40e80f
Showing with 104 additions and 82 deletions.
  1. +2 −1 helpfiles/system
  2. +63 −43 src/admin.c
  3. +0 −1 src/includes/globals.h
  4. +34 −32 src/messages.c
  5. +5 −5 userfiles/Test.D
@@ -1,6 +1,7 @@
~OLCommand :~RS system
~OLUsage :~RS system -m|-n|-r|-u
~OLUsage :~RS system -m|-n|-r|-u|-a

This shows various system parameters. If you use the -m option, then you
will see memory information, -n you will see netlink information, -r will
give you room information and -u will give you use related information.
The -a option shows all information.
@@ -440,6 +440,7 @@ listbans(UR_OBJECT user)
return;
case 1:
user->misc_op = 2;
break;
}
return;
}
@@ -452,6 +453,7 @@ listbans(UR_OBJECT user)
return;
case 1:
user->misc_op = 2;
break;
}
return;
}
@@ -3383,7 +3385,7 @@ system_details(UR_OBJECT user)
enum lvl_value lvl;
int days, hours, mins, secs;

if (word_count < 2) {
if (word_count < 2 || !strcasecmp("-a", word[1])) {
write_user(user,
"\n+----------------------------------------------------------------------------+\n");
sprintf(text, "System Details for %s (Amnuts version %s)", TALKER_NAME,
@@ -3498,24 +3500,26 @@ system_details(UR_OBJECT user)
"heartbeat", text, "resolving IP", rip[amsys->resolve_ip]);
vwrite_user(user, "| %-17.17s : %-54.54s |\n",
"swear ban", minmax[amsys->ban_swearing]);
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"| For other options, see: system -m, -n, -r, -u |\n");
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
if (word_count < 2) {
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"| For other options, see: system -m, -n, -r, -u, -a |\n");
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
}
}
/* user option */
if (!strcasecmp("-u", word[1])) {
if (!strcasecmp("-u", word[1]) || !strcasecmp("-a", word[1])) {
uccount = 0;
for (u = user_first; u; u = u->next) {
if (u->type == CLONE_TYPE) {
++uccount;
}
}
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"| ~OL~FCSystem Details - Users~RS |\n");
write_user(user,
@@ -3575,14 +3579,16 @@ system_details(UR_OBJECT user)
"wizport min login level",
user_level[amsys->wizport_level].name);
#endif
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
if (!strcasecmp("-u", word[1])) {
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
}
}
/* Netlinks Option */
if (!strcasecmp("-n", word[1])) {
write_user(user,
"+----------------------------------------------------------------------------+\n");
if (!strcasecmp("-n", word[1]) || !strcasecmp("-a", word[1])) {
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"| ~OL~FCSystem Details - Netlinks~RS |\n");
write_user(user,
@@ -3607,39 +3613,44 @@ system_details(UR_OBJECT user)
++nlocount;
}
}
vwrite_user(user, "| %-21.21s: %5d %-21.21s: %5d secs |\n", "total netlinks", nlcount, "idle time out", amsys->net_idle_time); /* XXX: Add amsys->keepalive_interval */
vwrite_user(user, "| %-21.21s: %5d %45s |\n",
"total netlinks", nlcount, " ");
vwrite_user(user, "| %-21.21s: %5d secs %-21.21s: %5d secs |\n",
"idle time out", amsys->net_idle_time,
"keepalive interval", amsys->keepalive_interval);
vwrite_user(user, "| %-21.21s: %5d %-21.21s: %5d |\n",
"accepting connects", rmnlicount, "live connects", nlupcount);
"accepting connects", rmnlicount,
"live connects", nlupcount);
vwrite_user(user, "| %-21.21s: %5d %-21.21s: %5d |\n",
"incoming connections", nlicount, "outgoing connections",
nlocount);
"incoming connections", nlicount,
"outgoing connections", nlocount);
vwrite_user(user, "| %-21.21s: %-13.13s %-21.21s: %-13.13s |\n",
"remote user maxlevel",
user_level[amsys->rem_user_maxlevel].name,
"remote user deflevel",
user_level[amsys->rem_user_deflevel].name);
"remote user maxlevel", user_level[amsys->rem_user_maxlevel].name,
"remote user deflevel", user_level[amsys->rem_user_deflevel].name);
vwrite_user(user, "| %-21.21s: %5d bytes %-21.21s: %5d bytes |\n",
"netlink structure", (int) (sizeof *nl), "total memory",
nlcount * (int) (sizeof *nl));
"netlink structure", (int) (sizeof *nl),
"total memory", nlcount * (int) (sizeof *nl));
#else
write_user(user,
"| Netlinks are not currently compiled into the talker. |\n");
#endif
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
if (!strcasecmp("-n", word[1])) {
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
}
}
/* Room Option */
if (!strcasecmp("-r", word[1])) {
if (!strcasecmp("-r", word[1]) || !strcasecmp("-a", word[1])) {
rmcount = rmpcount = 0;
for (rm = room_first; rm; rm = rm->next) {
++rmcount;
if (is_personal_room(rm)) {
++rmpcount;
}
}
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"| ~OL~FCSystem Details - Rooms~RS |\n");
write_user(user,
@@ -3659,12 +3670,14 @@ system_details(UR_OBJECT user)
vwrite_user(user, "| %-16.16s: %7d bytes %-20.20s: %7d bytes |\n",
"room structure", (int) (sizeof *rm), "total memory",
rmcount * (int) (sizeof *rm));
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
if (!strcasecmp("-r", word[1])) {
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
}
}
/* Memory Option */
if (!strcasecmp("-m", word[1])) {
if (!strcasecmp("-m", word[1]) || !strcasecmp("-a", word[1])) {
ucount = 0;
for (u = user_first; u; u = u->next) {
++ucount;
@@ -3696,8 +3709,8 @@ system_details(UR_OBJECT user)
}
tsize += nlcount * (sizeof *nl);
#endif
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"+----------------------------------------------------------------------------+\n");
write_user(user,
"| ~OL~FCSystem Details - Memory Object Allocation~RS |\n");
write_user(user,
@@ -3737,11 +3750,18 @@ system_details(UR_OBJECT user)
vwrite_user(user,
"| %-16.16s: %12.3f Mb %8d total bytes |\n",
"total", tsize / 1048576.0, tsize);
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
if (!strcasecmp("-m", word[1])) {
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
return;
}
}
if (!strcasecmp("-a", word[1])) {
write_user(user,
"+----------------------------------------------------------------------------+\n\n");
} else {
write_user(user, "Usage: system [-m|-n|-r|-u|-a]\n");
}
write_user(user, "Usage: system [-m|-n|-r|-u]\n");
}


@@ -661,7 +661,6 @@ const char talker_signature[] =
"| email 'me@my.place' if you have any questions/comments |\n"
"+--------------------------------------------------------------------------+\n";


struct last_login_struct last_login_info[LASTLOGON_NUM + 1] = { {"", "", 0} };

UR_OBJECT user_first = NULL;
@@ -57,38 +57,38 @@ count_suggestions(void)
int
count_motds(int forcecnt)
{
char filename[80];
DIR *dirp;
struct dirent *dp;
int i;

amsys->motd1_cnt = 0;
amsys->motd2_cnt = 0;
for (i = 1; i <= 2; ++i) {
/* open the directory file up */
sprintf(filename, "%s/motd%d", MOTDFILES, i);
dirp = opendir(filename);
if (!dirp) {
if (!forcecnt) {
fprintf(stderr, "Amnuts: Directory open failure in count_motds().\n");
boot_exit(20);
}
return 0;
}
/* count up the motd files */
for (dp = readdir(dirp); dp; dp = readdir(dirp)) {
if (!strncmp(dp->d_name, "motd", 4)) {
continue;
}
if (i == 1) {
++amsys->motd1_cnt;
} else {
++amsys->motd2_cnt;
}
}
closedir(dirp);
}
return 1;
char filename[80];
DIR *dirp;
struct dirent *dp;
int i;

amsys->motd1_cnt = 0;
amsys->motd2_cnt = 0;
for (i = 1; i <= 2; ++i) {
/* open the directory file up */
sprintf(filename, "%s/motd%d", MOTDFILES, i);
dirp = opendir(filename);
if (!dirp) {
if (!forcecnt) {
fprintf(stderr, "Amnuts: Directory open failure in count_motds().\n");
boot_exit(20);
}
return 0;
}
/* count up the motd files */
while ((dp = readdir(dirp)) != NULL) {
if (strncmp(dp->d_name, "motd", 4) != 0) {
continue;
}
if (i == 1) {
++amsys->motd1_cnt;
} else {
++amsys->motd2_cnt;
}
}
closedir(dirp);
}
return 1;
}


@@ -158,6 +158,7 @@ check_messages(UR_OBJECT user, int chforce)
write_syslog(SYSLOG, 1, "%s recounted the MOTDS.\n", user->name);
return;
}
break;
}
board_cnt = 0;
old_cnt = 0;
@@ -262,6 +263,7 @@ check_messages(UR_OBJECT user, int chforce)
board_cnt, PLTEXT_S(board_cnt), bad_cnt);
write_syslog(SYSLOG, 1, "%s forced a recount of the message boards.\n",
user->name);
break;
}
}

@@ -1,18 +1,18 @@
version 0.3
password NUKyNCCLvgLH.
promote_date on Saturday 8th December 2001 at 09:04pm
times 1039113061 2226 8 1009740417
times 1315269289 4090 4 1009740417
levels 6 6 0 0 0
general -1 0 0 1 1 0 0 3
general -1 0 0 1 1 0 0 7
user_set 1 0 0 23 1 1 0 0 0 0 1 0 #UNSET 0
user_ignores 0 0 0 0 0 0 0 0
purging 1
last_site 127.0.0.1 reception
purging 1 1318725289
last_site localhost reception
mail_verify #UNSET
description - remove this character
in_phrase enters
out_phrase goes
email #UNSET
homepage #UNSET
recap_name Test
games 0 0 0 0 6 10 1011 3000
games 0 0 0 0 6 10 1020 3000

0 comments on commit 99a4e82

Please sign in to comment.
You can’t perform that action at this time.