/*
* call-seq:
* File.set_attr(filename, attribute, attribute_value) -> attribute_value
*
* Sets the attribute <i>attribute</i> for the file <i>filename</i>
*
* File.set_attr("test.rb", "description", "test script") # => "test script"
*
*/
static VALUE rb_file_set_attr(obj, fname, aname, aval)
VALUE obj, fname, aname, aval;
{
int ret;
Check_Type(fname, T_STRING);
Check_Type(aname, T_STRING);
Check_Type(aval, T_STRING);
ret = attr_set(StringValueCStr(fname), StringValueCStr(aname),
StringValueCStr(aval), RSTRING(aval)->len, 1);
if(ret == 0) {
return aval;
} else {
rb_sys_fail(StringValueCStr(fname));
}
}