From 92acbe12bc9512100b9282d7e9d61fe86b5a60bb Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 26 Sep 2003 18:27:35 +0000 Subject: Refactor common file code into util.c; add published to descriptors svn:r487 --- src/common/util.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/common/util.h') diff --git a/src/common/util.h b/src/common/util.h index 94fcd512d..c90175669 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -56,6 +56,18 @@ int read_all(int fd, void *buf, size_t count); void set_socket_nonblocking(int socket); +typedef enum { FN_ERROR, FN_NOENT, FN_FILE, FN_DIR} file_status_t; + +/* Return FN_ERROR if filename can't be read, FN_NOENT if it doesn't + * exist, FN_FILE if it is a regular file, or FN_DIR if it's a + * directory. */ +file_status_t file_status(const char *filename); +/* Check whether dirname exists and is private. If yes returns + * 0. Else returns -1. + */ +int check_private_dir(const char *dirname, int create); +int write_str_to_file(const char *fname, const char *str); + /* Minimalist interface to run a void function in the background. On unix calls fork, on win32 calls beginthread. Returns -1 on failure. func should not return, but rather should call spawn_exit. -- cgit v1.2.3