[CODE] Online Setting of Command Min_Levels

From: Julian Buckley (s348266@student.uq.edu.au)
Date: 07/02/99


Hello list...

I've been trying to get the above mentioned thing coded, but I've run
into a few problems.  My guess is I'm probably not understanding how the
command_interpreter functions, but oh well...

My code exists as:
***SNIP***
ACMD(do_asdf)
{
 char newcmd;
  sh_int newlev;

  half_chop(argument, buf, arg);

  if (!*buf || !*arg || !isdigit(*arg))
    send_to_char("Syntax: asdf <command> <newlevel>\r\n", ch);
  else {
    newcmd = strdup(buf);
    newlev = atoi(arg);

    if (arg <= 0)
      log("Invalid.");
    else {
      complete_cmd_info[newcmd].minimum_level = arg;
      log("Changed.");
    }
    log("%s %d", complete_cmd_info[newcmd].command,
complete_cmd_info[newcmd].minimum_level);
  }
}
***END***

When I fire off the command as "asdf kill 30", syslogs report:
Jul  3 10:27:07 :: Changed.
Jul  3 10:27:07 :: credits 29744

And sure enough, "credits" is set to a min level of 29744.  If I try it
again (asdf kill 30), the mud crashes.

Gdb reports the following:
***SNIP***
GNU gdb 4.17
This GDB was configured as "i586-slackware-linux"...
Core was generated by `bin/circle'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.5...done.
Reading symbols from /lib/ld-linux.so.1...done.
#0  0x400321e8 in vfprintf ()
(gdb) bt
#0  0x400321e8 in vfprintf ()
#1  0x80e3232 in basic_mud_log (format=0x80efc1e "%s %d") at utils.c:154

#2  0x805dc0a in do_asdf (ch=0x8460480, argument=0xbffff7e4 " kill 30",
cmd=42, subcmd=0)
    at act.informative.c:2070
#3  0x80b15c1 in command_interpreter (ch=0x8460480, argument=0xbffff7e0
"asdf kill 30") at interpreter.c:870
#4  0x804a620 in game_loop (mother_desc=3) at comm.c:753
#5  0x8049ba1 in init_game (port=4000) at comm.c:342
#6  0x8049b0b in main (argc=1, argv=0xbffffb40) at comm.c:304
#7  0x804978e in _start ()
***END***

I'm really stuck for clues (perhaps clueless) in this, but perhaps
someone else can see the problem(s)?


Any help received I'd be appreciative.
-Caniffe


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



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