handle_call_command(term_T *term, channel_T *channel, listitem_T *item)
{
    char_u	*func;
    typval_T	argvars[2];
    typval_T	rettv;
    int		doesrange;

    if (item->li_next == NULL)
    {
	ch_log(channel, "Missing function arguments for call");
	return;
    }
    func = tv_get_string(&item->li_tv);

    if (STRNCMP(func, "Tapi_", 5) != 0)
    {
	ch_log(channel, "Invalid function name: %s", func);
	return;
    }

    argvars[0].v_type = VAR_NUMBER;
    argvars[0].vval.v_number = term->tl_buffer->b_fnum;
    argvars[1] = item->li_next->li_tv;
    if (call_func(func, (int)STRLEN(func), &rettv,
		2, argvars, /* argv_func */ NULL,
		/* firstline */ 1, /* lastline */ 1,
		&doesrange, /* evaluate */ TRUE,
		/* partial */ NULL, /* selfdict */ NULL) == OK)
    {
	clear_tv(&rettv);
	ch_log(channel, "Function %s called", func);
    }
    else
	ch_log(channel, "Calling function %s failed", func);
}
handle_call_command(term_T *term, channel_T *channel, listitem_T *item)
{
    char_u	*func;
    typval_T	argvars[2];
    typval_T	rettv;
    int		doesrange;

    if (item->li_next == NULL)
    {
	ch_log(channel, "Missing function arguments for call");
	return;
    }
    func = tv_get_string(&item->li_tv);

    if (STRNCMP(func, "Tapi_", 5) != 0)
    {
	ch_log(channel, "Invalid function name: %s", func);
	return;
    }

    argvars[0].v_type = VAR_NUMBER;
    argvars[0].vval.v_number = term->tl_buffer->b_fnum;
    argvars[1] = item->li_next->li_tv;
    if (call_func(func, (int)STRLEN(func), &rettv,
		2, argvars,   NULL,
		  1,   1,
		&doesrange,   TRUE,
		  NULL,   NULL) == OK)
    {
	clear_tv(&rettv);
	ch_log(channel, "Function %s called", func);
    }
    else
	ch_log(channel, "Calling function %s failed", func);
}