untermud/DOC/
untermud/DOC/U/
untermud/DOC/U/U-examples/
untermud/DOC/internals/
untermud/DOC/wizard/
untermud/MISC/
untermud/MISC/dbchk/
untermud/RWHO/
untermud/RWHO/rwhod/
/*
    Copyright (C) 1991, Marcus J. Ranum. All rights reserved.
*/

/* configure all options BEFORE including system stuff. */
#include    "config.h"
#include    "mud.h"
#include    "vars.h"

/*
TinyMUD-like "emote"
*/

/* ARGSUSED */
int cmd_do (int argc, char *argv[], char *who, char *aswho)
{
  char *uname;
  char *room;
  char *in;
  int ax;
  char nxtu[MAXOID];

  room = ut_loc (run_actor ());

  in = ut_getatt (room, 0, typ_list, var_ply, (char *) 0);
  if (in == (char *) 0) {
    /* We're not in a room, let's see if we're `in' a player. */
    in = ut_getatt (room, 0, typ_flag, var_isplay, (char *) 0);
    if (in == (char *) 0) {
      say (who, "You aren't anywhere.  Sit still.\n", (char *) 0);
      return (UERR_PERM);
    }

    /* We're 'inside' a player. */
    uname = ut_name (run_actor ());

    /* Do at the player. */
    say (room, uname, (char *) 0);
    for (ax = 1; ax < argc; ax++)
      say (room, " ", argv[ax], (char *) 0);
    say (room, "\n", (char *) 0);

    /* Do at us. */
    in = run_actor ();
    say (in, uname, (char *) 0);
    for (ax = 1; ax < argc; ax++)
      say (in, " ", argv[ax], (char *) 0);
    say (in, "\n", (char *) 0);
    return (UERR_NONE);
  }

  uname = ut_name (run_actor ());
  while ((in = lstnext (in, nxtu, sizeof (nxtu))) != (char *) 0) {
    say (nxtu, uname, (char *) 0);
    for (ax = 1; ax < argc; ax++)
      say (nxtu, " ", argv[ax], (char *) 0);
    say (nxtu, "\n", (char *) 0);
  }

  return (UERR_NONE);
}