]> git.marmaro.de Git - mmh/blobdiff - sbr/utils.c
* Red Hat Bug #253342: inc.c, utils.c, utils.h: When inc is run with the
[mmh] / sbr / utils.c
index 64df443b22455688012af8890d7190d104783515..87d368dde46d81b3ae7463741894d188e84837a9 100644 (file)
@@ -120,6 +120,29 @@ add (char *s2, char *s1)
     return cp;
 }
 
+/*
+ * folder_exists
+ *      Check to see if a folder exists.
+ */
+int folder_exists(char *folder)
+{
+    struct stat st;
+    int exists = 0;
+
+    if (stat (folder, &st) == -1) {
+        /* The folder either doesn't exist, or we hit an error.  Either way
+         * return a failure.
+         */
+        exists = 0;
+    } else {
+        /* We can see a folder with the right name */
+        exists = 1;
+    }
+
+    return exists;
+}
+
+
 /*
  * create_folder
  *      Check to see if a folder exists, if not, prompt the user to create