/* * call-seq: * File.ftype(file_name) => string * * Identifies the type of the named file; the return string is one of * ``<code>file</code>'', ``<code>directory</code>'', * ``<code>characterSpecial</code>'', ``<code>blockSpecial</code>'', * ``<code>fifo</code>'', ``<code>link</code>'', * ``<code>socket</code>'', or ``<code>unknown</code>''. * * File.ftype("testfile") #=> "file" * File.ftype("/dev/tty") #=> "characterSpecial" * File.ftype("/tmp/.X11-unix/X0") #=> "socket" */ static VALUE rb_file_s_ftype(klass, fname) VALUE klass, fname; { struct stat st; SafeStringValue(fname); if (lstat(StringValueCStr(fname), &st) == -1) { rb_sys_fail(RSTRING(fname)->ptr); } return rb_file_ftype(&st); }