-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.h
57 lines (47 loc) · 1.51 KB
/
base.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#define _GNU_SOURCE 1
#include <glib.h>
#include <gmime/gmime.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
typedef struct a_mail_file {
const char *path;
const char *tail;
char *backup_path;
char *pieces_base;
GMimeMessage *message;
GMimePart *text_part;
int part_count;
int eno;
} a_mail_file;
GMimeMessage *file_to_message(const char *path);
a_mail_file *mail_file_new(const char *path);
char *filename_to_suffix(const char *filename);
char *object_to_path(GMimeObject *part, a_mail_file *mf);
const char *media_type_to_extension(const char *media_type);
int chew(const char *path);
int message_save(GMimeMessage *message, const char *path, bool clobber);
int move_file(const char *src, const char *dest);
int object_save(GMimeObject *object, const char *path, bool clobber);
int usage(int x);
void create_head(a_mail_file *mf);
void foreach_callback(GMimeObject *parent, GMimeObject *part, gpointer data);
void mail_file_fini(a_mail_file **mf);
void min_headers(a_mail_file *mf);
void process_parts(a_mail_file *mf);
void wreak_havok(a_mail_file *mf);
extern int havok;
extern int verbose;
#define NO __LINE__
#define OK 0
#define dbgf(n, fmt, ...) \
if (n <= verbose) printf(fmt "\n", __VA_ARGS__)
#define woof(fmt, ...) \
fprintf(stderr, fmt "\n", __VA_ARGS__)