+/*
+ * mkdirp.c
+ *
+ * Copyright (c) 2019, Urban Wallasch
+ * BSD 3-Clause License, see LICENSE file for more details.
+ *
+ * Create a directory and its parents, if they do not already exist.
+ *
+ */
+
+
#include <errno.h>
#include <string.h>
*
* The mkdirp() function creates the directory pathname with the specified
* mode, if it does not already exist. If necessary, any missing parent
- * directories are created as part of the process. The file mode of each
- * created directory is ((mode | 0700) & ~umask & 0777). The modes of
- * already existing directories are left unchanged.
+ * directories are created as part of the process. The effective file mode
+ * used for each created directory is ((mode | 0700) & ~umask & 0777). The
+ * modes of already existing directories are left unchanged.
*
* The mkdirp() function returns 0, if the specified directory already
- * exists or was successfully created, or -1 if an error occurred, in
- * which case errno is set appropriately.
+ * existed or was successfully created, or -1 if an error occurred, in which
+ * case errno is set appropriately.
*/
extern int mkdirp(const char *pathname, mode_t mode);
+/*
+ * mkdirp_test.c
+ *
+ * Copyright (c) 2019, Urban Wallasch
+ * BSD 3-Clause License, see LICENSE file for more details.
+ *
+ * Simple, non-exhaustive quick check for mkdir.[ch].
+ *
+ * Build with:
+ * gcc -Wall -Wextra -Werror -O2 -omkdirp_test mkdirp.c mkdirp_test.c
+ */
+
#include <assert.h>
#include <errno.h>
#include <stdio.h>