blob: 991b83595ef62b176307f700b35cac73255a6408 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/
#include <unistd.h>
#include <iraf.h>
#ifndef VMS
#include <sys/types.h>
#include <sys/stat.h>
#endif
/* OS_SYMLINK -- Determine if a file is a symbolic link.
*/
int
os_symlink (
char *fname, /* file to be tested */
char *valbuf, /* buffer to receive link path, else NULL */
int maxch
)
{
#ifndef VMS
struct stat fi;
int n;
if (lstat (fname, &fi) == 0)
if ((fi.st_mode & S_IFMT) == S_IFLNK) {
if (valbuf && maxch)
if ((n = readlink (fname, valbuf, maxch)) > 0)
valbuf[n] = '\0';
return (1);
}
#endif
return (0);
}
|