f_setpos(typval_T *argvars, typval_T *rettv)
{
    pos_T	pos;
    int		fnum;
    char_u	*name;
    colnr_T	curswant = -1;

    rettv->vval.v_number = -1;
    name = tv_get_string_chk(argvars);
    if (name != NULL)
    {
	if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK)
	{
	    if (--pos.col < 0)
		pos.col = 0;
	    if (name[0] == '.' && name[1] == NUL)
	    {
		/* set cursor; "fnum" is ignored */
		curwin->w_cursor = pos;
		if (curswant >= 0)
		{
		    curwin->w_curswant = curswant - 1;
		    curwin->w_set_curswant = FALSE;
		}
		check_cursor();
		rettv->vval.v_number = 0;
	    }
	    else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL)
	    {
		/* set mark */
		if (setmark_pos(name[1], &pos, fnum) == OK)
		    rettv->vval.v_number = 0;
	    }
	    else
		emsg(_(e_invarg));
	}
    }
}
f_setpos(typval_T *argvars, typval_T *rettv)
{
    pos_T	pos;
    int		fnum;
    char_u	*name;
    colnr_T	curswant = -1;

    rettv->vval.v_number = -1;
    name = tv_get_string_chk(argvars);
    if (name != NULL)
    {
	if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK)
	{
	    if (--pos.col < 0)
		pos.col = 0;
	    if (name[0] == '.' && name[1] == NUL)
	    {
		 
		curwin->w_cursor = pos;
		if (curswant >= 0)
		{
		    curwin->w_curswant = curswant - 1;
		    curwin->w_set_curswant = FALSE;
		}
		check_cursor();
		rettv->vval.v_number = 0;
	    }
	    else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL)
	    {
		 
		if (setmark_pos(name[1], &pos, fnum) == OK)
		    rettv->vval.v_number = 0;
	    }
	    else
		emsg(_(e_invarg));
	}
    }
}