This repository has been archived on 2021-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
uIRCd/src/filesystem.h

59 lines
1.6 KiB
C

/*
* This file is part of uIRCd. (https://git.redxen.eu/caskd/uIRCd)
* Copyright (c) 2019, 2020 Alex-David Denes
*
* uIRCd is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* uIRCd is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with uIRCd. If not, see <https://www.gnu.org/licenses/>.
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#define UIRC_IRCV3
#include <uirc/types.h>
#include "connection.h"
#include "limits.h"
#include "logging.h"
#ifndef UIRCD_GUARD_FILESYSTEM
#define UIRCD_GUARD_FILESYSTEM
#define ISCMD(CMD) (message->cmd == (CMD))
typedef struct {
char* bufpos;
size_t len;
} PathBufElem;
typedef struct {
char buf[PATH_MAX];
PathBufElem elements[5];
} PathBuf;
int mkdir_bottomup(char* path);
int makeinput(char* path);
bool write_log(char* path, char* message);
bool cleanup_path_names(char* name);
bool add_socket_flags(int fd, int flags);
ssize_t set_path_elem(char* content, unsigned int nth_elem, bool isdir, PathBuf* buf);
signed int prepare_log_path(IRC_Message* message, PathBuf* pathbuffer, Connection* conn);
#endif /* UIRCD_GUARD_FILESYSTEM */