symlink?(p1)
public
Returns true if the named file is a symbolic link.
Show source
/*
* call-seq:
* File.symlink?(file_name) => true or false
*
* Returns <code>true</code> if the named file is a symbolic link.
*/
static VALUE
test_l(obj, fname)
VALUE obj, fname;
{
#ifndef S_ISLNK
# ifdef _S_ISLNK
# define S_ISLNK(m) _S_ISLNK(m)
# elif defined __BORLANDC__
# ifdef _S_IFLNK
# define S_ISLNK(m) (((unsigned short)(m) & S_IFMT) == _S_IFLNK)
# else
# ifdef S_IFLNK
# define S_ISLNK(m) (((unsigned short)(m) & S_IFMT) == S_IFLNK)
# endif
# endif
# else
# ifdef _S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
# else
# ifdef S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
# endif
# endif
# endif
#endif
#ifdef S_ISLNK
struct stat st;
SafeStringValue(fname);
if (lstat(StringValueCStr(fname), &st) < 0) return Qfalse;
if (S_ISLNK(st.st_mode)) return Qtrue;
#endif
return Qfalse;
}