/*
 * TermInfo#tigetstr(capname) => str
 *
 * TermInfo#tigetstr returns a string capability specified by capname.
 *
 * The return value should be printed after tputs is applied.
 * Also tparm should be applied if it has parameters.
 *
 *   io.print ti.tputs(ti.tparm(ti.tigetstr("cuf"), 2))
 *
 * Note that "cuf" means "cursor forward".
 */
static VALUE
rt_tigetstr(VALUE self, VALUE v_capname)
{
  char *ret;
  setup(self);
  ret = tigetstr(StringValueCStr(v_capname));
  if (ret == (char*)-1) {
    rb_raise(eTermInfoError, "not a string capability");
  }
  if (ret == 0) {
    rb_raise(eTermInfoError, "canceled or absent string capability");
  }
  return rb_str_new2(ret);
}