move set_nonblock, create_socket and path_exists to libi3

This commit is contained in:
Michael Stapelberg
2021-01-15 14:48:10 +01:00
committed by Michael Stapelberg
parent e4f12ac349
commit 131a6158c8
8 changed files with 139 additions and 76 deletions

21
libi3/path_exists.c Normal file
View File

@ -0,0 +1,21 @@
/*
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include "libi3.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
/*
* Checks if the given path exists by calling stat().
*
*/
bool path_exists(const char *path) {
struct stat buf;
return (stat(path, &buf) == 0);
}