[CODE] is_number()

From: Akuma/Chris Baggett/DOOMer (doomer@BAYOU.COM)
Date: 10/14/97


  ok, some of you may not wanna use this, but i did.
the idea behind it : I got sick of not being able to test
for Negative values with is_number() although atoi() allowed
them.  so, i "fixed" up is_number() to allow - numbers.

here's the code,
it's a small addition to is_number() in interpreter.c
put this at the beginning of the function (before the while{} statment)
and it should now allow you to send (normal) negative numbers to is_number
ie  -1 is a number, but --1 or ---1 is not (as per atoi() )
hope you enjoy it.

if (*str)
  {
  if(!isdigit(*str) && *(str++) != '-')
    { return 0; }
  }
else return 0;

Akuma the Raging Coder


  +------------------------------------------------------------+
  | "The poets talk about love, but what I talk about is DOOM, |
  |      because in the end, DOOM is all that counts." -       |
  |   Alex Machine/George Stark/Stephen King, The Dark Half    |
  |        "Nothing is IMPOSSIBLE, Just IMPROBABLE"            |
  |   "Easier Said Than Done, But Better Done Than Said..."    |
  +------------------------------------------------------------+


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST