summaryrefslogtreecommitdiffstats
path: root/src/bfstd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bfstd.h')
-rw-r--r--src/bfstd.h84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/bfstd.h b/src/bfstd.h
index 0e11b66..f85b74f 100644
--- a/src/bfstd.h
+++ b/src/bfstd.h
@@ -81,24 +81,6 @@ size_t xbaseoff(const char *path);
#include <stdio.h>
/**
- * close() variant that preserves errno.
- *
- * @param fd
- * The file descriptor to close.
- */
-void close_quietly(int fd);
-
-/**
- * close() wrapper that asserts the file descriptor is valid.
- *
- * @param fd
- * The file descriptor to close.
- * @return
- * 0 on success, or -1 on error.
- */
-int xclose(int fd);
-
-/**
* fopen() variant that takes open() style flags.
*
* @param path
@@ -121,25 +103,6 @@ FILE *xfopen(const char *path, int flags);
*/
char *xgetdelim(FILE *file, char delim);
-/**
- * A safe version of read() that handles interrupted system calls and partial
- * reads.
- *
- * @return
- * The number of bytes read. A value != nbytes indicates an error
- * (errno != 0) or end of file (errno == 0).
- */
-size_t xread(int fd, void *buf, size_t nbytes);
-
-/**
- * A safe version of write() that handles interrupted system calls and partial
- * writes.
- *
- * @return
- The number of bytes written. A value != nbytes indicates an error.
- */
-size_t xwrite(int fd, const void *buf, size_t nbytes);
-
// #include <stdlib.h>
/**
@@ -210,14 +173,41 @@ int dup_cloexec(int fd);
int pipe_cloexec(int pipefd[2]);
/**
- * Wrapper for confstr() that allocates with malloc().
+ * A safe version of read() that handles interrupted system calls and partial
+ * reads.
*
- * @param name
- * The ID of the confstr to look up.
* @return
- * The value of the confstr, or NULL on failure.
+ * The number of bytes read. A value != nbytes indicates an error
+ * (errno != 0) or end of file (errno == 0).
*/
-char *xconfstr(int name);
+size_t xread(int fd, void *buf, size_t nbytes);
+
+/**
+ * A safe version of write() that handles interrupted system calls and partial
+ * writes.
+ *
+ * @return
+ The number of bytes written. A value != nbytes indicates an error.
+ */
+size_t xwrite(int fd, const void *buf, size_t nbytes);
+
+/**
+ * close() variant that preserves errno.
+ *
+ * @param fd
+ * The file descriptor to close.
+ */
+void close_quietly(int fd);
+
+/**
+ * close() wrapper that asserts the file descriptor is valid.
+ *
+ * @param fd
+ * The file descriptor to close.
+ * @return
+ * 0 on success, or -1 on error.
+ */
+int xclose(int fd);
/**
* Wrapper for faccessat() that handles some portability issues.
@@ -239,6 +229,16 @@ int xfaccessat(int fd, const char *path, int amode);
char *xreadlinkat(int fd, const char *path, size_t size);
/**
+ * Wrapper for confstr() that allocates with malloc().
+ *
+ * @param name
+ * The ID of the confstr to look up.
+ * @return
+ * The value of the confstr, or NULL on failure.
+ */
+char *xconfstr(int name);
+
+/**
* Portability wrapper for strtofflags().
*
* @param str