summaryrefslogtreecommitdiff
path: root/src/fd.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
commit5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch)
tree684758441f5b431d0008253243034b6a4a29417c /src/fd.c
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'src/fd.c')
-rw-r--r--src/fd.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/fd.c b/src/fd.c
index 776575c..ad20812 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -1,6 +1,7 @@
-#include <fcntl.h>
#include "fd.h"
+#include <fcntl.h>
+
/**
@file fd.c
@autor djb
@@ -8,23 +9,26 @@
@brief file descriptor manipulation
*/
-int close(int __fd); /* we won't use unistd.h here */
+int close(int __fd); /* we won't use unistd.h here */
-int fd_copy(int to,int from)
+int fd_copy(int to, int from)
{
if (to == from) return 0;
- if (fcntl(from,F_GETFL,0) == -1) return -1;
+ if (fcntl(from, F_GETFL, 0) == -1) return -1;
close(to);
- if (fcntl(from,F_DUPFD,to) == -1) return -1;
+ if (fcntl(from, F_DUPFD, to) == -1) return -1;
return 0;
}
-int fd_move(int to,int from)
+int fd_move(int to, int from)
{
if (to == from) return 0;
- if (fd_copy(to,from) == -1) return -1;
+ if (fd_copy(to, from) == -1) return -1;
close(from);
return 0;
}
-int fd_coe(int fd) {return fcntl(fd,F_SETFD,1); }
+int fd_coe(int fd)
+{
+ return fcntl(fd, F_SETFD, 1);
+}