1 //
2 //	aegis - project change supervisor
3 //	Copyright (C) 1991-2006, 2008 Peter Miller
4 //
5 //	This program is free software; you can redistribute it and/or modify
6 //	it under the terms of the GNU General Public License as published by
7 //	the Free Software Foundation; either version 3 of the License, or
8 //	(at your option) any later version.
9 //
10 //	This program is distributed in the hope that it will be useful,
11 //	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //	GNU General Public License for more details.
14 //
15 //	You should have received a copy of the GNU General Public License
16 //	along with this program. If not, see
17 //	<http://www.gnu.org/licenses/>.
18 //
19 
20 #include <common/ac/stddef.h>
21 #include <common/ac/sys/types.h>
22 #include <common/ac/sys/stat.h>
23 
24 #include <libaegis/glue.h>
25 #include <libaegis/os.h>
26 #include <common/trace.h>
27 
28 
29 int
os_symlink_query(string_ty * path)30 os_symlink_query(string_ty *path)
31 {
32     int             result;
33     struct stat     st;
34 
35     trace(("os_symlink_query(\"%s\")\n{\n", path->str_text));
36     os_become_must_be_active();
37 #ifdef S_IFLNK
38     result =
39 	(!glue_lstat(path->str_text, &st) && (st.st_mode & S_IFMT) == S_IFLNK);
40 #else
41     result = 0;
42 #endif
43     trace(("return %d;\n", result));
44     trace(("}\n"));
45     return result;
46 }
47