#pragma save_types, rtt_checks
#include "/inc/base.inc"
#include "/inc/client.inc"

void receive_nl()
{
    // Just to make sure.
    call_out(#'shutdown, __HEART_BEAT_INTERVAL__, 1);
    
    input_to("receive_cmd");
}

void receive_cmd(string str)
{
    input_to("receive_cmd");

    if(!sizeof(str))
    {
        remove_call_out(#'shutdown);
        shutdown(0);
    }
}

void send_nl()
{
    write("\n");
    remove_interactive(this_object());
}

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

    /* We'll send a newline and close the connection.
     * This test succeeds if the input_to on the other
     * end receives an empty string.
     */
    connect_self("receive_nl", "send_nl");
}

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