1 /* vi: set sw=4 ts=4: */
5 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
6 * Permission has been granted to redistribute this code under the GPL.
8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
15 * Return TRUE if fileName is a directory.
16 * Nonexistent files return FALSE.
18 int FAST_FUNC is_directory(const char *fileName, int followLinks, struct stat *statBuf)
23 if (statBuf == NULL) {
24 /* use auto stack buffer */
29 status = stat(fileName, statBuf);
31 status = lstat(fileName, statBuf);
33 status = (status == 0 && S_ISDIR(statBuf->st_mode));