ldmud-3.3.719/
ldmud-3.3.719/doc/
ldmud-3.3.719/doc/efun.de/
ldmud-3.3.719/doc/efun/
ldmud-3.3.719/doc/man/
ldmud-3.3.719/doc/other/
ldmud-3.3.719/mud/
ldmud-3.3.719/mud/heaven7/
ldmud-3.3.719/mud/lp-245/
ldmud-3.3.719/mud/lp-245/banish/
ldmud-3.3.719/mud/lp-245/doc/
ldmud-3.3.719/mud/lp-245/doc/examples/
ldmud-3.3.719/mud/lp-245/doc/sefun/
ldmud-3.3.719/mud/lp-245/log/
ldmud-3.3.719/mud/lp-245/obj/Go/
ldmud-3.3.719/mud/lp-245/players/lars/
ldmud-3.3.719/mud/lp-245/room/death/
ldmud-3.3.719/mud/lp-245/room/maze1/
ldmud-3.3.719/mud/lp-245/room/sub/
ldmud-3.3.719/mud/lp-245/secure/
ldmud-3.3.719/mud/sticklib/
ldmud-3.3.719/mud/sticklib/src/
ldmud-3.3.719/mudlib/deprecated/
ldmud-3.3.719/mudlib/uni-crasher/
ldmud-3.3.719/pkg/
ldmud-3.3.719/pkg/debugger/
ldmud-3.3.719/pkg/diff/
ldmud-3.3.719/pkg/misc/
ldmud-3.3.719/src/
ldmud-3.3.719/src/autoconf/
ldmud-3.3.719/src/ptmalloc/
ldmud-3.3.719/src/util/
ldmud-3.3.719/src/util/erq/
ldmud-3.3.719/src/util/indent/hosts/next/
ldmud-3.3.719/src/util/xerq/
ldmud-3.3.719/src/util/xerq/lpc/
ldmud-3.3.719/src/util/xerq/lpc/www/
ldmud-3.3.719/test/generic/
ldmud-3.3.719/test/inc/
ldmud-3.3.719/test/t-0000398/
ldmud-3.3.719/test/t-0000548/
ldmud-3.3.719/test/t-030925/
ldmud-3.3.719/test/t-040413/
ldmud-3.3.719/test/t-041124/
ldmud-3.3.719/test/t-language/
#include "/inc/base.inc"
#include "/inc/gc.inc"

#include "/sys/input_to.h"
#include "/sys/rtlimits.h"

/* These functions are for the clone (the player object). */
void start_client()
{
    net_connect("127.0.0.1", query_mud_port());
}

int logon(int flag)
{
    set_prompt("");
    return 1;
}

/* These functions are for the blueprint (the virtual player that
   sends us the commands). */

/* We make two steps, one without and one with catch().
 * The later might abort the thread, so we have to start
 * a callout to shutdown with an error.
 */

int step = 0;

object connect()
{
    set_prompt("");
    
    while(get_eval_cost() > 100000);
    
    call_out(#'shutdown, 0, 1);
    if(step)
        catch(efun::input_to("bla",INPUT_NOECHO); reserve 50000);
    else
        efun::input_to("bla",INPUT_NOECHO);
    remove_call_out(#'shutdown);
    
    if(get_eval_cost() > 100000)
    {
        msg("Got my eval ticks back: FAILURE.\n");
        shutdown(1);
    }
    else if(!step)
    {
        step=1;
        this_object()->run_test2();
    }
    else
        start_gc(#'shutdown);

    return 0;
}

void run_test()
{
    msg("\nRunning test for #0000534:\n"
          "--------------------------\n");

    set_driver_hook(H_NOECHO,
        function void(int flag, object ob)
        {
            if(previous_object())
                raise_error("Intentional error in H_NOECHO hook.\n");
        });
    set_limits(LIMIT_EVAL, 200000);
    
    /* Waiting until LDMud is ready for users. */
    call_out("run_test2", 0);
}

void run_test2()
{
    object dummy;
    dummy = clone_object(this_object());
    dummy->start_client();
}

string *epilog(int eflag)
{
    run_test();
    return 0;
}