/*
 * TermInfo#tputs(str, affcnt) => str
 *
 * TermInfo#tputs expands padding informaiton using padding characters.
 * affcnt is a number of lines affected by the str.
 */
static VALUE
rt_tputs(VALUE self, VALUE v_str, VALUE v_affcnt)
{
  int ret;
  char *str;
  int affcnt;
  VALUE output;

  setup(self);
  str = StringValueCStr(v_str);
  affcnt = NUM2INT(v_affcnt);

  putfunc_output = output = rb_str_new2("");
  ret = tputs(str, affcnt, putfunc);
  putfunc_output = Qnil;

  if (ret == ERR) { rb_raise(eTermInfoError, "tputs failed"); }

  return output;
}