#endif
#endif
extern pid_t forked_dump_pid; /**< Process id of forking dump process */
-static void dump_users(DESC *call_by, char *match);
+static void dump_users(DESC * call_by, char *match);
static const char *time_format_1(long int dt);
static const char *time_format_2(long int dt);
}
}
}
-
#ifdef WIN32
/* Win32 read code here */
{
}
static void
-dump_users(DESC *call_by, char *match)
+dump_users(DESC * call_by, char *match)
{
DESC *d;
int count = 0;
char tbuf2[BUFFER_LEN];
if (!GoodObject(call_by->player)) {
- do_rawlog(LT_ERR, T("Bogus caller #%d of dump_users"), call_by->player);
+ do_rawlog(LT_ERR, T("Bogus caller #%d of dump_users"),
+ call_by->player);
return;
}
while (*match && *match == ' ')
now = mudtime;
if (SUPPORT_PUEBLO && (call_by->conn_flags & CONN_HTML)) {
- queue_newwrite(call_by, (const unsigned char *) "<img xch_mode=html>", 19);
+ queue_newwrite(call_by, (const unsigned char *) "<img xch_mode=html>",
+ 19);
queue_newwrite(call_by, (const unsigned char *) "<PRE>", 5);
}
if (poll_msg[0] == '\0')
strcpy(poll_msg, "Doing");
snprintf(tbuf2, BUFFER_LEN, "%-16s %10s %6s %s\n",
- T("Player Name"), T("On For"), T("Idle"), poll_msg);
+ T("Player Name"), T("On For"), T("Idle"), poll_msg);
queue_string(call_by, tbuf2);
for (d = descriptor_list; d; d = d->next) {
continue;
sprintf(tbuf1, "%-16s %10s %4s%c %s", Name(d->player),
- time_format_1(now - d->connected_at),
- time_format_2(now - d->last_time),
- (Dark(d->player) ? 'D' : (Hidden(d) ? 'H' : ' '))
- , d->doing);
+ time_format_1(now - d->connected_at),
+ time_format_2(now - d->last_time),
+ (Dark(d->player) ? 'D' : (Hidden(d) ? 'H' : ' '))
+ , d->doing);
queue_string(call_by, tbuf1);
queue_newwrite(call_by, (const unsigned char *) "\r\n", 2);
}
switch (count) {
- case 0:
- mush_strncpy(tbuf1, T("There are no players connected."), BUFFER_LEN);
- break;
- case 1:
- mush_strncpy(tbuf1, T("There is 1 player connected."), BUFFER_LEN);
- break;
- default:
- snprintf(tbuf1, BUFFER_LEN, T("There are %d players connected."), count);
- break;
+ case 0:
+ mush_strncpy(tbuf1, T("There are no players connected."), BUFFER_LEN);
+ break;
+ case 1:
+ mush_strncpy(tbuf1, T("There is 1 player connected."), BUFFER_LEN);
+ break;
+ default:
+ snprintf(tbuf1, BUFFER_LEN, T("There are %d players connected."),
+ count);
+ break;
}
queue_string(call_by, tbuf1);
if (SUPPORT_PUEBLO && (call_by->conn_flags & CONN_HTML)) {
queue_newwrite(call_by, (const unsigned char *) "\n</PRE>\n", 8);
- queue_newwrite(call_by, (const unsigned char *) "<img xch_mode=purehtml>",
- 23);
+ queue_newwrite(call_by,
+ (const unsigned char *) "<img xch_mode=purehtml>", 23);
} else
queue_newwrite(call_by, (const unsigned char *) "\r\n", 2);
}
depth = 0;
- if (!strcmp(command, IDLE_COMMAND))
+ if (!strncmp(command, IDLE_COMMAND, strlen(IDLE_COMMAND))) {
+ j = strlen(IDLE_COMMAND);
+ if ((int) strlen(command) > j) {
+ if (*(command + j) == ' ')
+ j++;
+ queue_write(d, (unsigned char *) command + j, strlen(command) - j);
+ queue_eol(d);
+ }
return 1;
+ }
+
(d->cmds)++;
send_prefix(d);
dump_info(d);
send_suffix(d);
- } else if (!strncmp(command, PREFIX_COMMAND, strlen(PREFIX_COMMAND))) {
+ } else if (!strncmp(command, PREFIX_COMMAND, strlen(PREFIX_COMMAND))) {
set_userstring(&d->output_prefix, command + strlen(PREFIX_COMMAND));
} else if (!strncmp(command, SUFFIX_COMMAND, strlen(SUFFIX_COMMAND))) {
set_userstring(&d->output_suffix, command + strlen(SUFFIX_COMMAND));
} else {
j = 0;
if (!strncmp(command, WHO_COMMAND, strlen(WHO_COMMAND)))
- j = strlen(WHO_COMMAND);
+ j = strlen(WHO_COMMAND);
else if (!strncmp(command, DOING_COMMAND, strlen(DOING_COMMAND)))
- j = strlen(DOING_COMMAND);
+ j = strlen(DOING_COMMAND);
else if (!strncmp(command, SESSION_COMMAND, strlen(SESSION_COMMAND)))
- j = strlen(SESSION_COMMAND);
+ j = strlen(SESSION_COMMAND);
if (j) {
send_prefix(d);
dump_users(d, command + j);
- send_suffix(d);
+ send_suffix(d);
} else if (!check_connect(d, command))
return 0;
}
* \param flags PEMIT_* flags
*/
void
-do_pemit_port(dbref player, const char *pc, const char *message, int flags) {
- DESC *d;
- int port;
-
- if (!Site(player)) {
- notify(player, T("Permission denied."));
- return;
- }
-
- port = atoi(pc);
- if (port <= 0) {
- notify(player, T("That's not a port number."));
- return;
- }
-
- if (!*message) {
- return;
- }
-
- d = port_desc(port);
- if (!d) {
- notify(player, T("That port is not active."));
- return;
- }
-
- if (!(flags & PEMIT_SILENT))
- notify_format(player, T("You pemit \"%s\" to %s."), message, (d->connected ? Name(d->player) : T("a connecting player")));
- queue_string_eol(d, message);
+do_pemit_port(dbref player, const char *pc, const char *message, int flags)
+{
+ DESC *d;
+ int port;
+
+ if (!Site(player)) {
+ notify(player, T("Permission denied."));
+ return;
+ }
+
+ port = atoi(pc);
+ if (port <= 0) {
+ notify(player, T("That's not a port number."));
+ return;
+ }
+
+ if (!*message) {
+ return;
+ }
+
+ d = port_desc(port);
+ if (!d) {
+ notify(player, T("That port is not active."));
+ return;
+ }
+
+ if (!(flags & PEMIT_SILENT))
+ notify_format(player, T("You pemit \"%s\" to %s."), message,
+ (d->
+ connected ? Name(d->
+ player) : T("a connecting player")));
+ queue_string_eol(d, message);
}
queue_string_eol(call_by, "### End INFO");
}
-COMMAND(cmd_dump_users) {
+COMMAND(cmd_dump_users)
+{
DESC *d;
#ifdef COLOREDWHO
int tcount = 0;
match = arg_left;
- if(!strcasecmp(cmd->name, "WHO"))
+ if (!strcasecmp(cmd->name, "WHO"))
doing = 0;
- else if(!strcasecmp(cmd->name, "SESSION"))
+ else if (!strcasecmp(cmd->name, "SESSION"))
doing = 2;
- else /* Otherwise.. whatever is called us give them the doing */
- doing = 3;
-
+ else /* Otherwise.. whatever is called us give them the doing */
+ doing = 3;
+
if (!GoodObject(player)) {
- do_rawlog(LT_ERR, T("Bogus caller #%d of dump_users"),
- player);
+ do_rawlog(LT_ERR, T("Bogus caller #%d of dump_users"), player);
return;
}
while (*match && *match == ' ')
if ((doing == 1) || !Priv_Who(player)) {
if (poll_msg[0] == '\0')
strcpy(poll_msg, "Doing");
- notify_format(player, "%s%-16s %4s %10s %6s %s%s",
- ANSI_HILITE, T("Player Name"), T("Aff"), T("On For"),
- T("Idle"), poll_msg, ANSI_END);
+ notify_format(player, "%s%-16s %4s %10s %6s %s%s",
+ ANSI_HILITE, T("Player Name"), T("Aff"), T("On For"),
+ T("Idle"), poll_msg, ANSI_END);
} else if (doing == 2) {
- notify_format(player, "%s%-16s %6s %9s %5s %5s Des Sent Recv Pend%s",
- ANSI_HILITE, T("Player Name"), T("Loc #"), T("On For"), T("Idle"),
- T("Cmds"), ANSI_END);
+ notify_format(player,
+ "%s%-16s %6s %9s %5s %5s Des Sent Recv Pend%s",
+ ANSI_HILITE, T("Player Name"), T("Loc #"), T("On For"),
+ T("Idle"), T("Cmds"), ANSI_END);
} else {
notify_format(player, "%s%-16s %6s %9s %5s %5s Des Host%s",
- ANSI_HILITE,
- T("Player Name"), T("Loc #"), T("On For"), T("Idle"),
- T("Cmds"), ANSI_END);
+ ANSI_HILITE,
+ T("Player Name"), T("Loc #"), T("On For"), T("Idle"),
+ T("Cmds"), ANSI_END);
}
for (d = descriptor_list; d; d = d->next) {
sprintf(tbuf1, "%-16s %6s %9s %5s %4d %3d%c %s",
tprintf("%s%s", Name(d->player),
InProg(d->player) ? "(P)" : ""),
- Can_Locate(player, d->player) ? unparse_dbref(Location(d->
- player)) :
+ Can_Locate(player,
+ d->
+ player) ? unparse_dbref(Location(d->player)) :
"#-1", time_format_1(now - d->connected_at),
time_format_2(now - d->last_time), csite ? d->cmds : 0,
csite ? d->descriptor : 0,
sprintf(tbuf1, "%-16s %6s %9s %5s %5d %3d%c %5lu %7lu %5d",
tprintf("%s%s", Name(d->player),
InProg(d->player) ? "(P)" : ""),
- Can_Locate(player, d->player) ? unparse_dbref(Location(d->player)) :
+ Can_Locate(player,
+ d->player) ? unparse_dbref(Location(d->
+ player)) :
"#-1", time_format_1(now - d->connected_at),
time_format_2(now - d->last_time), csite ? d->cmds : 0,
csite ? d->descriptor : 0,
if (!Hidden(d) || Priv_Who(player)) {
#ifdef COLOREDWHO
- notify_format(player,
- "%s%s%s%s%s", ANSI_END,
- (tcount % 2 ? "" : ANSI_HILITE),
- (tcount % 2 ? ANSI_CYAN : ANSI_WHITE),
- tbuf1, ANSI_NORMAL);
+ notify_format(player,
+ "%s%s%s%s%s", ANSI_END,
+ (tcount % 2 ? "" : ANSI_HILITE),
+ (tcount % 2 ? ANSI_CYAN : ANSI_WHITE),
+ tbuf1, ANSI_NORMAL);
#else
- notify(player, tbuf1);
+ notify(player, tbuf1);
#endif
}
d->input_chars, d->output_chars, d->output_size);
}
#ifdef COLOREDWHO
- notify_format(player,
- "%s%s%s%s%s", ANSI_NORMAL,
- tcount % 2 ? "" : ANSI_HILITE,
- tcount % 2 ? ANSI_CYAN : ANSI_WHITE, tbuf1,
- ANSI_NORMAL);
+ notify_format(player,
+ "%s%s%s%s%s", ANSI_NORMAL,
+ tcount % 2 ? "" : ANSI_HILITE,
+ tcount % 2 ? ANSI_CYAN : ANSI_WHITE, tbuf1,
+ ANSI_NORMAL);
#else
- notify(player, tbuf1);
+ notify(player, tbuf1);
#endif
}
}
}
#ifdef COLOREDWHO
- notify_format(player, "%s%s%s%s%s", ANSI_NORMAL, (tcount + 1) % 2 ? "" : ANSI_HILITE,
- (tcount + 1) % 2 ? ANSI_CYAN : ANSI_WHITE, tbuf1,
- ANSI_NORMAL);
+ notify_format(player, "%s%s%s%s%s", ANSI_NORMAL,
+ (tcount + 1) % 2 ? "" : ANSI_HILITE,
+ (tcount + 1) % 2 ? ANSI_CYAN : ANSI_WHITE, tbuf1,
+ ANSI_NORMAL);
#else
- notify(player, tbuf1);
+ notify(player, tbuf1);
#endif
if (SUPPORT_PUEBLO) {
PUSE;
return;
}
- if (!Priv_Who(executor))
- powered = 0;
+ if (!Priv_Who(executor))
+ powered = 0;
}
DESC_ITER_CONN(d) {
if (!(strchr(called_as, 'M') != NULL) && Priv_Who(executor))
powered = 1;
-
+
first = 1;
if (!xwho && nargs && args[0] && *args[0]) {
if (!powered) {
safe_str(T(e_perm), buff, bp);
return;
}
- if (!Priv_Who(executor))
+ if (!Priv_Who(executor))
powered = 0;
} else
victim = executor;
safe_str(T(e_perm), buff, bp);
return;
}
- if ((getlock(zone, Zone_Lock) == TRUE_BOOLEXP) ||
- (IsPlayer(zone)
- && !(has_flag_by_name(zone, "SHARED", TYPE_PLAYER)))) {
+ if ((getlock(zone, Zone_Lock) == TRUE_BOOLEXP) || (IsPlayer(zone)
+ &&
+ !(has_flag_by_name
+ (zone, "SHARED",
+ TYPE_PLAYER)))) {
safe_str(T("#-1 INVALID ZONE."), buff, bp);
return;
}
if (nargs && args[0] && *args[0]) {
/* An argument was given. Find the victim and adjust perms */
- if ((victim = noisy_match_result(executor, args[0], NOTYPE, MAT_EVERYTHING)) == NOTHING) {
+ if ((victim =
+ noisy_match_result(executor, args[0], NOTYPE,
+ MAT_EVERYTHING)) == NOTHING) {
safe_str(T(e_notvis), buff, bp);
return;
}
- if (!Priv_Who(executor))
+ if (!Priv_Who(executor))
powered = 0;
}
if (nargs > 1 && args[1] && *args[1]) {
- if (string_prefix("all", args[1])) {
- offline = online = 1;
- } else if (strlen(args[1]) < 2) {
- safe_str(T("#-1 INVALID SECOND ARGUMENT"), buff, bp);
- return;
- } else if (string_prefix("online", args[1])) {
- online = 1;
- offline = 0;
- } else if (string_prefix("offline", args[1])) {
- online = 0;
- offline = 1;
- } else {
- safe_str(T("#-1 INVALID SECOND ARGUMENT"), buff, bp);
- return;
- }
- if (offline && !powered) {
- safe_str(T("#-1 PERMISSION DENIED"), buff, bp);
- return;
- }
- }
-
- DESC_ITER(d) {
- if ((d->connected && !online) || (!d->connected && !offline))
- continue;
- if (!powered && (d->connected && Hidden(d)))
- continue;
- if (first)
- first = 0;
- else
- safe_chr(' ', buff, bp);
- safe_integer(d->descriptor, buff, bp);
- }
+ if (string_prefix("all", args[1])) {
+ offline = online = 1;
+ } else if (strlen(args[1]) < 2) {
+ safe_str(T("#-1 INVALID SECOND ARGUMENT"), buff, bp);
+ return;
+ } else if (string_prefix("online", args[1])) {
+ online = 1;
+ offline = 0;
+ } else if (string_prefix("offline", args[1])) {
+ online = 0;
+ offline = 1;
+ } else {
+ safe_str(T("#-1 INVALID SECOND ARGUMENT"), buff, bp);
+ return;
+ }
+ if (offline && !powered) {
+ safe_str(T("#-1 PERMISSION DENIED"), buff, bp);
+ return;
+ }
+ }
+
+ DESC_ITER(d) {
+ if ((d->connected && !online) || (!d->connected && !offline))
+ continue;
+ if (!powered && (d->connected && Hidden(d)))
+ continue;
+ if (first)
+ first = 0;
+ else
+ safe_chr(' ', buff, bp);
+ safe_integer(d->descriptor, buff, bp);
+ }
}
/* ARGSUSED */