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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
#ifndef __GLOBAL_H
#define __GLOBAL_H
#include "config.h"
#include <termios.h>
#include "utils.h"
#include "log.h"
#ifdef __MAIN_FILE_C
#define GLOBAL_EXTERN
#else
#define GLOBAL_EXTERN extern
#endif
struct global_user {
char *name;
char *email;
};
struct global_core {
speed_t baud_rate;
int read_timeout;
int sms_init;
char *device;
int verbose;
int interactive;
char *msg_store_read;
char *msg_store_send;
char *msg_store_new;
char *pb_store;
char *editor;
char *edit_file;
};
struct global_smtp {
char *server;
int port;
char *user;
char *passwd;
char *encryption;
};
struct global_send_email {
char *domain;
};
struct global_config {
struct global_user user;
struct global_core core;
struct global_smtp smtp;
struct global_send_email send_email;
};
#if __MAIN_FILE_C
struct global_config Global = {
.user = {
.name = NULL,
.email = NULL,
},
.core = {
.verbose = false,
.interactive = true,
.sms_init = true,
.baud_rate = B115200,
.read_timeout = 5000,
.device = DEFAULT_DEVICE,
.msg_store_read = "MT",
.msg_store_send = "MT",
.msg_store_new = "MT",
.pb_store = "ME",
.editor = "vi",
.edit_file = "${HOME}/.smsmsg",
},
.smtp = {
.server = NULL,
.port = 0,
.user = NULL,
.passwd = NULL,
.encryption = NULL,
},
.send_email = {
.domain = NULL,
},
};
#else
extern struct global_config Global;
#endif
#endif /* ~__GLOBAL_H */
|