b_int.c

untermud/U/b_int.c · 501 B

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

Download the archive   « Back to the archive contents

#include    "config.h"
#include    "mud.h"
#include    "u.h"
#include    "y.tab.h"

/* convert a string (or something) to a NUM */
int ub_int (char *who, char *aswho, int ac, Nod * av[], Nod * retnode)
{
  switch (av[0]->rv.t) {
  case STR:
    retnode->rv.iv = atoi (av[0]->rv.cv);
    break;
  case NUM:
    retnode->rv.iv = av[0]->rv.iv;
    break;
  case OID:
  case VNULL:
    retnode->rv.iv = 0;
    break;
  default:
    return (UERR_FATAL);
  }

  retnode->rv.t = NUM;
  return (UERR_NONE);
}

Site Stats

Snippets: 1791
Codebases: 571