Start documenting libc.
Bug: N/A
Test: N/A
Change-Id: I17345cb72a5ffc3af1688cf5874589cfb1e1fea0
diff --git a/libc/include/fnmatch.h b/libc/include/fnmatch.h
index 3fcc665..1788a27 100644
--- a/libc/include/fnmatch.h
+++ b/libc/include/fnmatch.h
@@ -26,27 +26,45 @@
* SUCH DAMAGE.
*/
-#ifndef _FNMATCH_H
-#define _FNMATCH_H
+#pragma once
+
+/**
+ * @file fnmatch.h
+ * @brief Filename matching.
+ */
#include <sys/cdefs.h>
__BEGIN_DECLS
-#define FNM_NOMATCH 1 /* Match failed. */
-#define FNM_NOSYS 2 /* Function not supported (unused). */
+/** Returned by fnmatch() if matching failed. */
+#define FNM_NOMATCH 1
-#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
-#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
-#define FNM_PERIOD 0x04 /* Period must be matched by period. */
-#define FNM_LEADING_DIR 0x08 /* Ignore /<tail> after Imatch. */
-#define FNM_CASEFOLD 0x10 /* Case insensitive search. */
+/** Returned by fnmatch() if the function is not supported. This is never returned on Android. */
+#define FNM_NOSYS 2
+/** fnmatch() flag to disable backslash escaping. */
+#define FNM_NOESCAPE 0x01
+/** fnmatch() flag to ensure that slashes must be matched by slashes. */
+#define FNM_PATHNAME 0x02
+/** fnmatch() flag to ensure that periods must be matched by periods. */
+#define FNM_PERIOD 0x04
+/** fnmatch() flag to ignore /... after a match. */
+#define FNM_LEADING_DIR 0x08
+/** fnmatch() flag for a case-insensitive search. */
+#define FNM_CASEFOLD 0x10
+
+/** Synonym for `FNM_CASEFOLD`: case-insensitive search. */
#define FNM_IGNORECASE FNM_CASEFOLD
+/** Synonym for `FNM_PATHNAME`: slashes must be matched by slashes. */
#define FNM_FILE_NAME FNM_PATHNAME
-int fnmatch(const char* __pattern, const char* __string, int __flags);
+/**
+ * [fnmatch(3)](http://man7.org/linux/man-pages/man3/fnmatch.3.html) matches `__string` against
+ * the shell wildcard `__pattern`.
+ *
+ * Returns 0 on success, and returns `FNM_NOMATCH` on failure.
+ */
+int fnmatch(const char* _Nonnull __pattern, const char* _Nonnull __string, int __flags);
__END_DECLS
-
-#endif