From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- unix/boot/bootlib/ossymlink.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 unix/boot/bootlib/ossymlink.c (limited to 'unix/boot/bootlib/ossymlink.c') diff --git a/unix/boot/bootlib/ossymlink.c b/unix/boot/bootlib/ossymlink.c new file mode 100644 index 00000000..991b8359 --- /dev/null +++ b/unix/boot/bootlib/ossymlink.c @@ -0,0 +1,35 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#include +#include + +#ifndef VMS +#include +#include +#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); +} -- cgit