#ifndef SUDO_EDIT_H
#define SUDO_EDIT_H
#if defined(O_SEARCH)
# if defined(HAVE_DECL_O_DIRECTORY) && HAVE_DECL_O_DIRECTORY
# define DIR_OPEN_FLAGS (O_SEARCH|O_DIRECTORY)
# else
# define DIR_OPEN_FLAGS (O_SEARCH)
# endif
#elif defined(O_PATH)
# if defined(HAVE_DECL_O_DIRECTORY) && HAVE_DECL_O_DIRECTORY
# define DIR_OPEN_FLAGS (O_PATH|O_DIRECTORY)
# else
# define DIR_OPEN_FLAGS (O_PATH)
# endif
#elif defined(HAVE_DECL_O_DIRECTORY) && HAVE_DECL_O_DIRECTORY
# define DIR_OPEN_FLAGS (O_RDONLY|O_DIRECTORY)
#else
# define DIR_OPEN_FLAGS (O_RDONLY|O_NONBLOCK)
#endif
int sudo_copy_file(const char *src, int src_fd, off_t src_len, const char *dst, int dst_fd, off_t dst_len);
bool sudo_check_temp_file(int tfd, const char *tname, uid_t uid, struct stat *sb);
struct sudo_cred;
void switch_user(uid_t euid, gid_t egid, int ngroups, GETGROUPS_T *groups);
int sudo_edit_open(char *path, int oflags, mode_t mode, unsigned int sflags, const struct sudo_cred *user_cred, const struct sudo_cred *cur_cred);
int dir_is_writable(int dfd, const struct sudo_cred *user_cred, const struct sudo_cred *cur_cred);
bool sudo_edit_parent_valid(char *path, unsigned int sflags, const struct sudo_cred *user_cred, const struct sudo_cred *cur_cred);
#endif