read.c

untermud/CMD/read.c · 936 B

From the archive untermud-2.4-r22.tar.gz

Download the archive   « Back to the archive contents

/*
    Copyright (C) 1991, Marcus J. Ranum. All rights reserved.
*/

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

/*
read text off of something.
*/


/* ARGSUSED */
int cmd_read (int argc, char *argv[], char *who, char *aswho)
{
  char ob[MAXOID];
  char *ap;

  if (matchlocal (who, argv[1], ut_loc (run_actor ()),
      MTCH_UNIQ | MTCH_MEOK | MTCH_NONLOC, ob))
    return (UERR_NOMATCH);

  /* text ? */
  ap = ut_getatt (ob, 0, typ_str, var_text, (char *) 0);
  if (ap != (char *) 0) {
    say (who, ap, "\n", (char *) 0);
    return (UERR_NONE);
  }

  /* no text ? desc */
  ap = ut_getatt (ob, 0, typ_str, var_desc, (char *) 0);
  if (ap != (char *) 0) {
    say (who, ap, "\n", (char *) 0);
    return (UERR_NONE);
  }


  say (who, "You see nothing written there.\n", (char *) 0);
  return (UERR_NONE);
}

Site Stats

Snippets: 1791
Codebases: 571