*/
int mutt_file_copy_bytes(FILE *fp_in, FILE *fp_out, size_t size)
{
+ if (!fp_in || !fp_out)
+ return -1;
+
while (size > 0)
{
char buf[2048];
*/
int mutt_file_copy_stream(FILE *fp_in, FILE *fp_out)
{
+ if (!fp_in || !fp_out)
+ return -1;
+
size_t l;
char buf[1024];
*/
int mutt_file_rmtree(const char *path)
{
+ if (!path)
+ return -1;
+
struct dirent *de = NULL;
char cur[PATH_MAX];
struct stat statbuf;
*/
int mutt_file_sanitize_regex(struct Buffer *dest, const char *src)
{
+ if (!dest || !src)
+ return -1;
+
mutt_buffer_reset(dest);
while (*src != '\0')
{
*/
char *mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, int flags)
{
+ if (!size || !fp)
+ return NULL;
+
size_t offset = 0;
char *ch = NULL;
*/
bool mutt_file_iter_line(struct MuttFileIter *iter, FILE *fp, int flags)
{
+ if (!iter)
+ return false;
+
char *p = mutt_file_read_line(iter->line, &iter->size, fp, &iter->line_num, flags);
if (!p)
return false;
*/
bool mutt_file_map_lines(mutt_file_map_t func, void *user_data, FILE *fp, int flags)
{
+ if (!func || !fp)
+ return false;
+
struct MuttFileIter iter = { 0 };
while (mutt_file_iter_line(&iter, fp, flags))
{
*/
size_t mutt_file_quote_filename(const char *filename, char *buf, size_t buflen)
{
+ if (!buf)
+ return 0;
+
if (!filename)
{
*buf = '\0';
*/
time_t mutt_file_decrease_mtime(const char *fp, struct stat *st)
{
+ if (!fp)
+ return -1;
+
struct utimbuf utim;
struct stat st2;
time_t mtime;
*/
void mutt_file_expand_fmt(char *dest, size_t destlen, const char *fmt, const char *src)
{
+ if (!dest || !fmt || !src)
+ return;
+
const char *p = NULL;
char *d = NULL;
size_t slen;
*/
int mutt_file_timespec_compare(struct timespec *a, struct timespec *b)
{
+ if (!a || !b)
+ return 0;
if (a->tv_sec < b->tv_sec)
return -1;
if (a->tv_sec > b->tv_sec)
*/
void mutt_file_get_stat_timespec(struct timespec *dest, struct stat *sb, enum MuttStatType type)
{
+ if (!dest || !sb)
+ return;
+
dest->tv_sec = 0;
dest->tv_nsec = 0;
int mutt_file_stat_timespec_compare(struct stat *sba, enum MuttStatType type,
struct timespec *b)
{
+ if (!sba || !b)
+ return 0;
+
struct timespec a = { 0 };
mutt_file_get_stat_timespec(&a, sba, type);
int mutt_file_stat_compare(struct stat *sba, enum MuttStatType sba_type,
struct stat *sbb, enum MuttStatType sbb_type)
{
+ if (!sba || !sbb)
+ return 0;
+
struct timespec a = { 0 };
struct timespec b = { 0 };