summaryrefslogtreecommitdiff
path: root/utils/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/utils.c')
-rw-r--r--utils/utils.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/utils.c b/utils/utils.c
new file mode 100644
index 0000000..4e7d80f
--- /dev/null
+++ b/utils/utils.c
@@ -0,0 +1,30 @@
+/*
+ * This file is part of NetSurf, http://netsurf.sourceforge.net/
+ * Licensed under the GNU General Public License,
+ * http://www.opensource.org/licenses/gpl-license
+ * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
+ * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
+ * Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
+ * Copyright 2004 John Tytgat <John.Tytgat@aaug.net>
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include "nstheme/utils/utils.h"
+
+/**
+ * Check if a directory exists.
+ */
+
+bool is_dir(const char *path)
+{
+ struct stat s;
+
+ if (stat(path, &s))
+ return false;
+
+ return S_ISDIR(s.st_mode) ? true : false;
+}