xref: /OK3568_Linux_fs/buildroot/package/smstools3/0002-fix-build-with-gcc-10.x.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Description: fix of FTBFS with gcc10
2Author: Thorsten Alteholz <debian@alteholz.de>
3
4Fetch from: <https://salsa.debian.org/debian-mobcom-team/smstools/-/blob/57a358a9eebbe2ca5639cc526f7027944ed95ea1/debian/patches/gcc10.patch>
5
6Signed-off-by: Michael Fischer <mf@go-sys.de>
7
8Index: smstools/src/smsd_cfg.h
9===================================================================
10--- smstools.orig/src/smsd_cfg.h	2020-08-05 19:02:50.536596441 +0000
11+++ smstools/src/smsd_cfg.h	2020-08-05 19:33:22.915005150 +0000
12@@ -126,17 +126,17 @@
13 #define ALPHABET_UNKNOWN        4
14 #define ALPHABET_DEFAULT        0
15
16-char process_title[32];         // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
17-int process_id;                 // -1 for main task, all modems have numbers starting with 0.
18+extern char process_title[32];         // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
19+extern int process_id;                 // -1 for main task, all modems have numbers starting with 0.
20                                 // This is the same as device, can be used like devices[process_id] if IS_MODEM_PROCESS.
21
22-time_t process_start_time;
23+extern time_t process_start_time;
24
25-int modem_handle;               // Handle for modem.
26+extern int modem_handle;               // Handle for modem.
27
28-int put_command_timeouts;
29-unsigned long long put_command_sent; // 3.1.16beta.
30-char tmpdir[PATH_MAX];          // 3.1.16beta.
31+extern int put_command_timeouts;
32+extern unsigned long long put_command_sent; // 3.1.16beta.
33+extern char tmpdir[PATH_MAX];          // 3.1.16beta.
34
35 typedef struct
36 {
37@@ -284,204 +284,204 @@
38
39 // NOTE for regular run intervals: effective value is at least delaytime.
40
41-char configfile[PATH_MAX];	// Path to config file
42-char d_spool[PATH_MAX];		// Spool directory
43-char d_failed[PATH_MAX];	// Failed spool directory
44-char d_failed_copy[PATH_MAX];	// 3.1.17.
45-char d_incoming[PATH_MAX];	// Incoming spool directory
46-char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
47-char d_report[PATH_MAX];	// Incoming report spool directory
48-char d_report_copy[PATH_MAX];	// 3.1.17.
49-char d_phonecalls[PATH_MAX];    // Incoming phonecalls data directory
50-char d_saved[PATH_MAX];         // Directory for smsd's internal use, concatenation storage files etc.
51-char d_sent[PATH_MAX];		// Sent spool directory
52-char d_sent_copy[PATH_MAX];	// 3.1.17.
53-char d_checked[PATH_MAX];	// Spool directory for checked messages (only used when no provider queues used)
54-char eventhandler[PATH_MAX];	// Global event handler program or script
55-char alarmhandler[PATH_MAX];	// Global alarm handler program or script
56-char checkhandler[PATH_MAX];    // Handler that checks if the sms file is valid.
57-int alarmlevel;			// Alarm Level (9=highest). Verbosity of alarm handler.
58-char logfile[PATH_MAX];		// Name or Handle of Log File
59-int  loglevel;			// Log Level (9=highest). Verbosity of log file.
60-_queue queues[NUMBER_OF_MODEMS]; // Queues
61-_device devices[NUMBER_OF_MODEMS]; // Modem devices
62-int delaytime;			// sleep-time after workless
63-int delaytime_mainprocess;      // sleep-time after workless, main process. If -1, delaytime is used.
64-int blocktime;			// sleep-time after multiple errors
65-int blockafter;                 // Block modem after n errors
66-int errorsleeptime;		// sleep-time after each error
67-int autosplit;			// Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
68-int receive_before_send;	// if 1 smsd tries to receive one message before sending
69-int store_received_pdu;         // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
70-int store_sent_pdu;             // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
71-int validity_period;            // Validity period for messages.
72-int decode_unicode_text;        // 1 if unicode text is decoded internally.
73-int internal_combine;           // 1 if multipart message is combined internally.
74-int internal_combine_binary;    // 1 if multipart binary message is combined internally. Defaults to internal_combine.
75-int keep_filename;              // 0 if unique filename is created to each directory when a message file is moved.
76-int store_original_filename;    // 1 if an original filename is saved to message file when it's moved from
77-                                // outgoing directory to spooler. Works together with keep_filename.
78-int date_filename;              // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
79-char regular_run[PATH_MAX];     // Script/program which is run regularly.
80-int regular_run_interval;       // Number of seconds between running a regular_run script/progdam.
81-char admin_to[SIZE_TO];         // Destination number for administrative messages.
82-int filename_preview;           // Number of chars of message text to concatenate to filename.
83-int incoming_utf8;              // 1 if incoming files are saved using UTF-8 character set.
84-int outgoing_utf8;              // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
85-int log_charconv;               // 1 if character set conversion is logged.
86-int log_single_lines;           // 1 if linefeeds are removed from the modem response to be logged.
87-int executable_check;           // 0 if eventhandler and other executables are NOT checked during the startup checking.
88-int keep_messages;              // For testing purposes: messages are not deleted and smsd stops after first run.
89-char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
90-int ic_purge_hours;             // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
91-int ic_purge_minutes;           // and if there is message parts older than defined, they are handled or deleted.
92-int ic_purge_read;              // 1 = message parts are stored as single messages. 0 = parts are just deleted.
93-int ic_purge_interval;          //
94-char shell[PATH_MAX];           // Shell used to run eventhandler, defaults to /bin/sh
95-char adminmessage_device[32];   // Name of device used to send administrative messages of mainspooler.
96-int smart_logging;              // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
97-int status_signal_quality;      // 1 = signal quality is written to status file.
98-int status_include_counters;    // 1 = succeeded, failed and received counters are included in the status line.
99-int status_include_uptime;      // 3.1.16beta: 1 = include started & uptime line in the status file.
100-int hangup_incoming_call;       // 1 = if detected unexpected input contains RING and we want to end call.
101-int max_continuous_sending;     // Defines when sending is breaked to do check/do other tasks. Time in minutes.
102-int voicecall_hangup_ath;       // If ATH is used instead of AT+CHUP.
103+extern char configfile[PATH_MAX];	// Path to config file
104+extern char d_spool[PATH_MAX];		// Spool directory
105+extern char d_failed[PATH_MAX];	// Failed spool directory
106+extern char d_failed_copy[PATH_MAX];	// 3.1.17.
107+extern char d_incoming[PATH_MAX];	// Incoming spool directory
108+extern char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
109+extern char d_report[PATH_MAX];	// Incoming report spool directory
110+extern char d_report_copy[PATH_MAX];	// 3.1.17.
111+extern char d_phonecalls[PATH_MAX];    // Incoming phonecalls data directory
112+extern char d_saved[PATH_MAX];         // Directory for smsd's internal use, concatenation storage files etc.
113+extern char d_sent[PATH_MAX];		// Sent spool directory
114+extern char d_sent_copy[PATH_MAX];	// 3.1.17.
115+extern char d_checked[PATH_MAX];	// Spool directory for checked messages (only used when no provider queues used)
116+extern char eventhandler[PATH_MAX];	// Global event handler program or script
117+extern char alarmhandler[PATH_MAX];	// Global alarm handler program or script
118+extern char checkhandler[PATH_MAX];    // Handler that checks if the sms file is valid.
119+extern int alarmlevel;			// Alarm Level (9=highest). Verbosity of alarm handler.
120+extern char logfile[PATH_MAX];		// Name or Handle of Log File
121+extern int  loglevel;			// Log Level (9=highest). Verbosity of log file.
122+extern _queue queues[NUMBER_OF_MODEMS]; // Queues
123+extern _device devices[NUMBER_OF_MODEMS]; // Modem devices
124+extern int delaytime;			// sleep-time after workless
125+extern int delaytime_mainprocess;      // sleep-time after workless, main process. If -1, delaytime is used.
126+extern int blocktime;			// sleep-time after multiple errors
127+extern int blockafter;                 // Block modem after n errors
128+extern int errorsleeptime;		// sleep-time after each error
129+extern int autosplit;			// Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
130+extern int receive_before_send;	// if 1 smsd tries to receive one message before sending
131+extern int store_received_pdu;         // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
132+extern int store_sent_pdu;             // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
133+extern int validity_period;            // Validity period for messages.
134+extern int decode_unicode_text;        // 1 if unicode text is decoded internally.
135+extern int internal_combine;           // 1 if multipart message is combined internally.
136+extern int internal_combine_binary;    // 1 if multipart binary message is combined internally. Defaults to internal_combine.
137+extern int keep_filename;              // 0 if unique filename is created to each directory when a message file is moved.
138+extern int store_original_filename;    // 1 if an original filename is saved to message file when it's moved from
139+// outgoing directory to spooler. Works together with keep_filename.
140+extern int date_filename;              // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
141+extern char regular_run[PATH_MAX];     // Script/program which is run regularly.
142+extern int regular_run_interval;       // Number of seconds between running a regular_run script/progdam.
143+extern char admin_to[SIZE_TO];         // Destination number for administrative messages.
144+extern int filename_preview;           // Number of chars of message text to concatenate to filename.
145+extern int incoming_utf8;              // 1 if incoming files are saved using UTF-8 character set.
146+extern int outgoing_utf8;              // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
147+extern int log_charconv;               // 1 if character set conversion is logged.
148+extern int log_single_lines;           // 1 if linefeeds are removed from the modem response to be logged.
149+extern int executable_check;           // 0 if eventhandler and other executables are NOT checked during the startup checking.
150+extern int keep_messages;              // For testing purposes: messages are not deleted and smsd stops after first run.
151+extern char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
152+extern int ic_purge_hours;             // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
153+extern int ic_purge_minutes;           // and if there is message parts older than defined, they are handled or deleted.
154+extern int ic_purge_read;              // 1 = message parts are stored as single messages. 0 = parts are just deleted.
155+extern int ic_purge_interval;          //
156+extern char shell[PATH_MAX];           // Shell used to run eventhandler, defaults to /bin/sh
157+extern char adminmessage_device[32];   // Name of device used to send administrative messages of mainspooler.
158+extern int smart_logging;              // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
159+extern int status_signal_quality;      // 1 = signal quality is written to status file.
160+extern int status_include_counters;    // 1 = succeeded, failed and received counters are included in the status line.
161+extern int status_include_uptime;      // 3.1.16beta: 1 = include started & uptime line in the status file.
162+extern int hangup_incoming_call;       // 1 = if detected unexpected input contains RING and we want to end call.
163+extern int max_continuous_sending;     // Defines when sending is breaked to do check/do other tasks. Time in minutes.
164+extern int voicecall_hangup_ath;       // If ATH is used instead of AT+CHUP.
165
166 // 3.1.5:
167-int trust_outgoing;             // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
168+extern int trust_outgoing;             // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
169
170 // 3.1.5:
171-int ignore_outgoing_priority;   // 1 = Priority: high header is not checked. Speeds up spooling.
172+extern int ignore_outgoing_priority;   // 1 = Priority: high header is not checked. Speeds up spooling.
173
174 // 3.1.7:
175-int ignore_exec_output;         // 1 = stdout and stderr of eventhandlers is _not_ checked.
176+extern int ignore_exec_output;         // 1 = stdout and stderr of eventhandlers is _not_ checked.
177
178 // 3.1.7:
179-mode_t conf_umask;              // File mode creation mask for smsd and modem processes.
180+extern mode_t conf_umask;              // File mode creation mask for smsd and modem processes.
181
182 // 3.1.7:
183-int trim_text;                  // 1 = trailing whitespaces are removed from text:
184+extern int trim_text;                  // 1 = trailing whitespaces are removed from text:
185
186 // 3.1.7:
187-int use_linux_ps_trick;         // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
188+extern int use_linux_ps_trick;         // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
189
190 // 3.1.7:
191-int log_unmodified;
192+extern int log_unmodified;
193
194 // 3.1.7:
195-char suspend_filename[PATH_MAX];
196+extern char suspend_filename[PATH_MAX];
197
198 // 3.1.9:
199-int spool_directory_order;
200+extern int spool_directory_order;
201
202 // 3.1.9: 1 if read_from_modem is logged.
203-int log_read_from_modem;
204+extern int log_read_from_modem;
205
206 // 3.1.16beta2: log_read_timing for performance tuning.
207-int log_read_timing;
208+extern int log_read_timing;
209
210 // 3.1.16beta:
211-int log_response_time;
212+extern int log_response_time;
213
214 // 3.1.16beta2:
215-int default_alphabet;
216+extern int default_alphabet;
217
218 // 3.1.17: Child process for the mainprocess:
219-char mainprocess_child[PATH_MAX];
220-char mainprocess_child_args[PATH_MAX];
221+extern char mainprocess_child[PATH_MAX];
222+extern char mainprocess_child_args[PATH_MAX];
223
224 // 3.1.17: Notifier for the mainprocess:
225-int mainprocess_notifier;
226+extern int mainprocess_notifier;
227
228 // 3.1.17: If *_copy was made, evenhandler can use it instead of original file:
229-int eventhandler_use_copy;
230+extern int eventhandler_use_copy;
231
232 // 3.1.17: This defines how long to sleep while looping:
233-int sleeptime_mainprocess;
234+extern int sleeptime_mainprocess;
235
236 // 3.1.17: Defines how often PID is checked to detect if another smsd is running:
237-int check_pid_interval;
238+extern int check_pid_interval;
239
240 // 3.1.18: start script/program for mainprocess:
241-char mainprocess_start[PATH_MAX];
242-char mainprocess_start_args[PATH_MAX];
243+extern char mainprocess_start[PATH_MAX];
244+extern char mainprocess_start_args[PATH_MAX];
245
246-int message_count;              // Counter for sent messages. Multipart message is one message.
247+extern int message_count;              // Counter for sent messages. Multipart message is one message.
248
249-volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
250-volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
251+extern volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
252+extern volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
253
254-char username[65];              // user and group name which are used to run.
255-char groupname[65];             // (max length is just a guess)
256+extern char username[65];              // user and group name which are used to run.
257+extern char groupname[65];             // (max length is just a guess)
258
259-char infofile[PATH_MAX];        // Hepler file for stopping the smsd smoothly.
260-char pidfile[PATH_MAX];         // File where a process id is stored.
261+extern char infofile[PATH_MAX];        // Hepler file for stopping the smsd smoothly.
262+extern char pidfile[PATH_MAX];         // File where a process id is stored.
263
264 // Command line arguments:
265-char arg_username[65];
266-char arg_groupname[65];
267-char arg_infofile[PATH_MAX];
268-char arg_pidfile[PATH_MAX];
269-char arg_logfile[PATH_MAX];
270-int arg_terminal;
271+extern char arg_username[65];
272+extern char arg_groupname[65];
273+extern char arg_infofile[PATH_MAX];
274+extern char arg_pidfile[PATH_MAX];
275+extern char arg_logfile[PATH_MAX];
276+extern int arg_terminal;
277 // 3.1.7:
278-char arg_7bit_packed[512];
279-int do_encode_decode_arg_7bit_packed;
280+extern char arg_7bit_packed[512];
281+extern int do_encode_decode_arg_7bit_packed;
282
283-int terminal;                   // 1 if smsd is communicating with terminal.
284-pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
285-char run_info[PATH_MAX];        // Information about external script/program execution.
286+extern int terminal;                   // 1 if smsd is communicating with terminal.
287+extern pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
288+extern char run_info[PATH_MAX];        // Information about external script/program execution.
289
290-char communicate[32];           // Device name for terminal communication mode.
291+extern char communicate[32];           // Device name for terminal communication mode.
292
293-char international_prefixes[PATH_MAX +1];
294-char national_prefixes[PATH_MAX +1];
295+extern char international_prefixes[PATH_MAX +1];
296+extern char national_prefixes[PATH_MAX +1];
297
298 // Storage for startup errors:
299-char *startup_err_str;
300-int startup_err_count;
301+extern char *startup_err_str;
302+extern int startup_err_count;
303
304 // Storage for PDU's:
305-char *incoming_pdu_store;
306-char *outgoing_pdu_store;
307-char *routed_pdu_store;
308+extern char *incoming_pdu_store;
309+extern char *outgoing_pdu_store;
310+extern char *routed_pdu_store;
311
312 // Storage for getfile errors:
313-char *getfile_err_store;
314+extern char *getfile_err_store;
315
316 // Text buffer for error messages:
317-char tb[SIZE_TB];
318+extern char tb[SIZE_TB];
319
320 // Buffer for SIM memory checking:
321-char *check_memory_buffer;
322-size_t check_memory_buffer_size;
323+extern char *check_memory_buffer;
324+extern size_t check_memory_buffer_size;
325
326-int os_cygwin;                  // 1 if we are on Cygwin.
327+extern int os_cygwin;                  // 1 if we are on Cygwin.
328
329-char language_file[PATH_MAX];   // File name of translated headers.
330-char yes_chars[SIZE_HEADER];    // Characters which mean "yes" in the yesno() question.
331-char no_chars[SIZE_HEADER];     // See details inside read_translation() function.
332-char yes_word[SIZE_HEADER];     // "yes" printed as an output.
333-char no_word[SIZE_HEADER];      // "no"
334-char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
335-char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
336-char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
337-int translate_incoming;         // 0 if incoming message headers are NOT transtaled.
338+extern char language_file[PATH_MAX];   // File name of translated headers.
339+extern char yes_chars[SIZE_HEADER];    // Characters which mean "yes" in the yesno() question.
340+extern char no_chars[SIZE_HEADER];     // See details inside read_translation() function.
341+extern char yes_word[SIZE_HEADER];     // "yes" printed as an output.
342+extern char no_word[SIZE_HEADER];      // "no"
343+extern char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
344+extern char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
345+extern char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
346+extern int translate_incoming;         // 0 if incoming message headers are NOT transtaled.
347
348 // 3.1.14:
349-int logtime_us;
350-int logtime_ms;
351+extern int logtime_us;
352+extern int logtime_ms;
353
354 // 3.1.14:
355-int shell_test;
356+extern int shell_test;
357
358 // Next two are for debugging purposes:
359-int enable_smsd_debug;
360-char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
361+extern int enable_smsd_debug;
362+extern char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
363
364 // 3.1.20: Alt keys in communication mode:
365 #define COMMUNICATE_A_KEY_COUNT 10
366-char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
367+extern char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
368
369 /* initialize all variable with default values */
370
371Index: smstools/src/smsd_cfg.c
372===================================================================
373--- smstools.orig/src/smsd_cfg.c	2020-07-27 19:00:41.616207603 +0000
374+++ smstools/src/smsd_cfg.c	2020-08-05 19:17:41.595712888 +0000
375@@ -38,6 +38,221 @@
376 #include "modeminit.h"
377 #include "charshift.h"
378
379+
380+/* global variables */
381+char process_title[32];         // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
382+int process_id;                 // -1 for main task, all modems have numbers starting with 0.
383+                                // This is the same as device, can be used like devices[process_id] if IS_MODEM_PROCESS.
384+
385+time_t process_start_time;
386+
387+int modem_handle;               // Handle for modem.
388+
389+int put_command_timeouts;
390+unsigned long long put_command_sent; // 3.1.16beta.
391+char tmpdir[PATH_MAX];          // 3.1.16beta.
392+
393+// NOTE for regular run intervals: effective value is at least delaytime.
394+
395+char configfile[PATH_MAX];	// Path to config file
396+char d_spool[PATH_MAX];		// Spool directory
397+char d_failed[PATH_MAX];	// Failed spool directory
398+char d_failed_copy[PATH_MAX];	// 3.1.17.
399+char d_incoming[PATH_MAX];	// Incoming spool directory
400+char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
401+char d_report[PATH_MAX];	// Incoming report spool directory
402+char d_report_copy[PATH_MAX];	// 3.1.17.
403+char d_phonecalls[PATH_MAX];    // Incoming phonecalls data directory
404+char d_saved[PATH_MAX];         // Directory for smsd's internal use, concatenation storage files etc.
405+char d_sent[PATH_MAX];		// Sent spool directory
406+char d_sent_copy[PATH_MAX];	// 3.1.17.
407+char d_checked[PATH_MAX];	// Spool directory for checked messages (only used when no provider queues used)
408+char eventhandler[PATH_MAX];	// Global event handler program or script
409+char alarmhandler[PATH_MAX];	// Global alarm handler program or script
410+char checkhandler[PATH_MAX];    // Handler that checks if the sms file is valid.
411+int alarmlevel;			// Alarm Level (9=highest). Verbosity of alarm handler.
412+char logfile[PATH_MAX];		// Name or Handle of Log File
413+int  loglevel;			// Log Level (9=highest). Verbosity of log file.
414+_queue queues[NUMBER_OF_MODEMS]; // Queues
415+_device devices[NUMBER_OF_MODEMS]; // Modem devices
416+int delaytime;			// sleep-time after workless
417+int delaytime_mainprocess;      // sleep-time after workless, main process. If -1, delaytime is used.
418+int blocktime;			// sleep-time after multiple errors
419+int blockafter;                 // Block modem after n errors
420+int errorsleeptime;		// sleep-time after each error
421+int autosplit;			// Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
422+int receive_before_send;	// if 1 smsd tries to receive one message before sending
423+int store_received_pdu;         // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
424+int store_sent_pdu;             // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
425+int validity_period;            // Validity period for messages.
426+int decode_unicode_text;        // 1 if unicode text is decoded internally.
427+int internal_combine;           // 1 if multipart message is combined internally.
428+int internal_combine_binary;    // 1 if multipart binary message is combined internally. Defaults to internal_combine.
429+int keep_filename;              // 0 if unique filename is created to each directory when a message file is moved.
430+int store_original_filename;    // 1 if an original filename is saved to message file when it's moved from
431+                                // outgoing directory to spooler. Works together with keep_filename.
432+int date_filename;              // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
433+char regular_run[PATH_MAX];     // Script/program which is run regularly.
434+int regular_run_interval;       // Number of seconds between running a regular_run script/progdam.
435+char admin_to[SIZE_TO];         // Destination number for administrative messages.
436+int filename_preview;           // Number of chars of message text to concatenate to filename.
437+int incoming_utf8;              // 1 if incoming files are saved using UTF-8 character set.
438+int outgoing_utf8;              // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
439+int log_charconv;               // 1 if character set conversion is logged.
440+int log_single_lines;           // 1 if linefeeds are removed from the modem response to be logged.
441+int executable_check;           // 0 if eventhandler and other executables are NOT checked during the startup checking.
442+int keep_messages;              // For testing purposes: messages are not deleted and smsd stops after first run.
443+char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
444+int ic_purge_hours;             // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
445+int ic_purge_minutes;           // and if there is message parts older than defined, they are handled or deleted.
446+int ic_purge_read;              // 1 = message parts are stored as single messages. 0 = parts are just deleted.
447+int ic_purge_interval;          //
448+char shell[PATH_MAX];           // Shell used to run eventhandler, defaults to /bin/sh
449+char adminmessage_device[32];   // Name of device used to send administrative messages of mainspooler.
450+int smart_logging;              // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
451+int status_signal_quality;      // 1 = signal quality is written to status file.
452+int status_include_counters;    // 1 = succeeded, failed and received counters are included in the status line.
453+int status_include_uptime;      // 3.1.16beta: 1 = include started & uptime line in the status file.
454+int hangup_incoming_call;       // 1 = if detected unexpected input contains RING and we want to end call.
455+int max_continuous_sending;     // Defines when sending is breaked to do check/do other tasks. Time in minutes.
456+int voicecall_hangup_ath;       // If ATH is used instead of AT+CHUP.
457+
458+// 3.1.5:
459+int trust_outgoing;             // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
460+
461+// 3.1.5:
462+int ignore_outgoing_priority;   // 1 = Priority: high header is not checked. Speeds up spooling.
463+
464+// 3.1.7:
465+int ignore_exec_output;         // 1 = stdout and stderr of eventhandlers is _not_ checked.
466+
467+// 3.1.7:
468+mode_t conf_umask;              // File mode creation mask for smsd and modem processes.
469+
470+// 3.1.7:
471+int trim_text;                  // 1 = trailing whitespaces are removed from text:
472+
473+// 3.1.7:
474+int use_linux_ps_trick;         // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
475+
476+// 3.1.7:
477+int log_unmodified;
478+
479+// 3.1.7:
480+char suspend_filename[PATH_MAX];
481+
482+// 3.1.9:
483+int spool_directory_order;
484+
485+// 3.1.9: 1 if read_from_modem is logged.
486+int log_read_from_modem;
487+
488+// 3.1.16beta2: log_read_timing for performance tuning.
489+int log_read_timing;
490+
491+// 3.1.16beta:
492+int log_response_time;
493+
494+// 3.1.16beta2:
495+int default_alphabet;
496+
497+// 3.1.17: Child process for the mainprocess:
498+char mainprocess_child[PATH_MAX];
499+char mainprocess_child_args[PATH_MAX];
500+
501+// 3.1.17: Notifier for the mainprocess:
502+int mainprocess_notifier;
503+
504+// 3.1.17: If *_copy was made, evenhandler can use it instead of original file:
505+int eventhandler_use_copy;
506+
507+// 3.1.17: This defines how long to sleep while looping:
508+int sleeptime_mainprocess;
509+
510+// 3.1.17: Defines how often PID is checked to detect if another smsd is running:
511+int check_pid_interval;
512+
513+// 3.1.18: start script/program for mainprocess:
514+char mainprocess_start[PATH_MAX];
515+char mainprocess_start_args[PATH_MAX];
516+
517+int message_count;              // Counter for sent messages. Multipart message is one message.
518+
519+volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
520+volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
521+
522+char username[65];              // user and group name which are used to run.
523+char groupname[65];             // (max length is just a guess)
524+
525+char infofile[PATH_MAX];        // Hepler file for stopping the smsd smoothly.
526+char pidfile[PATH_MAX];         // File where a process id is stored.
527+
528+// Command line arguments:
529+char arg_username[65];
530+char arg_groupname[65];
531+char arg_infofile[PATH_MAX];
532+char arg_pidfile[PATH_MAX];
533+char arg_logfile[PATH_MAX];
534+int arg_terminal;
535+// 3.1.7:
536+char arg_7bit_packed[512];
537+int do_encode_decode_arg_7bit_packed;
538+
539+int terminal;                   // 1 if smsd is communicating with terminal.
540+pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
541+char run_info[PATH_MAX];        // Information about external script/program execution.
542+
543+char communicate[32];           // Device name for terminal communication mode.
544+
545+char international_prefixes[PATH_MAX +1];
546+char national_prefixes[PATH_MAX +1];
547+
548+// Storage for startup errors:
549+char *startup_err_str;
550+int startup_err_count;
551+
552+// Storage for PDU's:
553+char *incoming_pdu_store;
554+char *outgoing_pdu_store;
555+char *routed_pdu_store;
556+
557+// Storage for getfile errors:
558+char *getfile_err_store;
559+
560+// Text buffer for error messages:
561+char tb[SIZE_TB];
562+
563+// Buffer for SIM memory checking:
564+char *check_memory_buffer;
565+size_t check_memory_buffer_size;
566+
567+int os_cygwin;                  // 1 if we are on Cygwin.
568+
569+char language_file[PATH_MAX];   // File name of translated headers.
570+char yes_chars[SIZE_HEADER];    // Characters which mean "yes" in the yesno() question.
571+char no_chars[SIZE_HEADER];     // See details inside read_translation() function.
572+char yes_word[SIZE_HEADER];     // "yes" printed as an output.
573+char no_word[SIZE_HEADER];      // "no"
574+char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
575+char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
576+char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
577+int translate_incoming;         // 0 if incoming message headers are NOT transtaled.
578+
579+// 3.1.14:
580+int logtime_us;
581+int logtime_ms;
582+
583+// 3.1.14:
584+int shell_test;
585+
586+// Next two are for debugging purposes:
587+int enable_smsd_debug;
588+char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
589+
590+// 3.1.20: Alt keys in communication mode:
591+#define COMMUNICATE_A_KEY_COUNT 10
592+char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
593+
594 char *msg_dir = "%s directory %s cannot be opened.";
595 char *msg_file = "%s directory %s is not writable.";
596 char *msg_not_executable = "is not executable for smsd.";
597Index: smstools/src/logging.c
598===================================================================
599--- smstools.orig/src/logging.c	2020-07-27 19:00:41.612207583 +0000
600+++ smstools/src/logging.c	2020-08-05 19:27:38.373800111 +0000
601@@ -25,6 +25,16 @@
602 #include "smsd_cfg.h"
603 #include "stats.h"
604
605+
606+// 3.1.16beta2: Moved logch() and prch() from charset.c to logging.c:
607+char logch_buffer[8192];
608+
609+char prch(char ch);
610+
611+// 3.1.16beta: changed type:
612+//int trouble_logging_started;
613+time_t trouble_logging_started;
614+
615 int Filehandle = -1;
616 int Level;
617 int SavedLevel;
618Index: smstools/src/logging.h
619===================================================================
620--- smstools.orig/src/logging.h	2020-07-27 19:00:41.612207583 +0000
621+++ smstools/src/logging.h	2020-08-05 19:27:52.077848035 +0000
622@@ -18,7 +18,7 @@
623 #include <time.h>
624
625 // 3.1.16beta2: Moved logch() and prch() from charset.c to logging.c:
626-char logch_buffer[8192];
627+extern char logch_buffer[8192];
628
629 #ifdef __GNUC__
630 void logch(char* format, ...) __attribute__ ((format(printf, 1, 2)));
631@@ -26,11 +26,11 @@
632 void logch(char* format, ...);
633 #endif
634
635-char prch(char ch);
636+extern char prch(char ch);
637
638 // 3.1.16beta: changed type:
639 //int trouble_logging_started;
640-time_t trouble_logging_started;
641+extern time_t trouble_logging_started;
642
643 int change_loglevel(int new_level);
644 void restore_loglevel();
645Index: smstools/src/stats.c
646===================================================================
647--- smstools.orig/src/stats.c	2020-07-27 19:00:41.616207603 +0000
648+++ smstools/src/stats.c	2020-08-05 19:28:58.094078936 +0000
649@@ -29,6 +29,20 @@
650 #include <mm.h>
651 #endif
652
653+
654+_stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
655+int rejected_counter;		// Statistic counter, rejected SM, number does not fit into any queue
656+time_t start_time;		// Start time of smsd, allows statistic functions
657+int printstatus;		// if 1 smsd outputs status on stdout
658+time_t last_stats;		// time when the last stats file was created
659+char d_stats[PATH_MAX];		// path to statistic files
660+int stats_interval;		// time between statistic files in seconds.
661+int stats_no_zeroes;		// Suppress files that contain only zeroes
662+int status_interval;            // time between updating status file in seconds
663+
664+char *shared_buffer;
665+
666+
667 char newstatus[NUMBER_OF_MODEMS +1] = {0};
668 char oldstatus[NUMBER_OF_MODEMS +1] = {0};
669
670Index: smstools/src/stats.h
671===================================================================
672--- smstools.orig/src/stats.h	2020-07-27 19:00:41.616207603 +0000
673+++ smstools/src/stats.h	2020-08-05 19:29:14.750137182 +0000
674@@ -33,17 +33,17 @@
675   int ber;
676 } _stats;
677
678-_stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
679-int rejected_counter;		// Statistic counter, rejected SM, number does not fit into any queue
680-time_t start_time;		// Start time of smsd, allows statistic functions
681-int printstatus;		// if 1 smsd outputs status on stdout
682-time_t last_stats;		// time when the last stats file was created
683-char d_stats[PATH_MAX];		// path to statistic files
684-int stats_interval;		// time between statistic files in seconds.
685-int stats_no_zeroes;		// Suppress files that contain only zeroes
686-int status_interval;            // time between updating status file in seconds
687+extern _stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
688+extern int rejected_counter;		// Statistic counter, rejected SM, number does not fit into any queue
689+extern time_t start_time;		// Start time of smsd, allows statistic functions
690+extern int printstatus;		// if 1 smsd outputs status on stdout
691+extern time_t last_stats;		// time when the last stats file was created
692+extern char d_stats[PATH_MAX];		// path to statistic files
693+extern int stats_interval;		// time between statistic files in seconds.
694+extern int stats_no_zeroes;		// Suppress files that contain only zeroes
695+extern int status_interval;            // time between updating status file in seconds
696
697-char *shared_buffer;
698+extern char *shared_buffer;
699
700 /* Creates shared memory variables for statistic data */
701
702Index: smstools/src/blacklist.c
703===================================================================
704--- smstools.orig/src/blacklist.c	2020-07-27 19:00:41.612207583 +0000
705+++ smstools/src/blacklist.c	2020-08-05 19:34:13.903183463 +0000
706@@ -23,6 +23,8 @@
707 #include "alarm.h"
708 #include "smsd_cfg.h"
709
710+char blacklist[256];     // Filename of the black-list
711+
712 int inblacklist(char* msisdn)
713 {
714   FILE* file;
715Index: smstools/src/blacklist.h
716===================================================================
717--- smstools.orig/src/blacklist.h	2020-07-27 19:00:41.612207583 +0000
718+++ smstools/src/blacklist.h	2020-08-05 19:34:04.903151994 +0000
719@@ -15,7 +15,7 @@
720 #ifndef BLACK_H
721 #define BLACK_H
722
723-char blacklist[256];	// Filename of the black-list
724+extern char blacklist[256];	// Filename of the black-list
725
726 int inblacklist(char* msisdn);
727
728Index: smstools/src/whitelist.c
729===================================================================
730--- smstools.orig/src/whitelist.c	2020-07-27 19:00:41.616207603 +0000
731+++ smstools/src/whitelist.c	2020-08-05 19:39:23.436266057 +0000
732@@ -23,6 +23,8 @@
733 #include "alarm.h"
734 #include "smsd_cfg.h"
735
736+char whitelist[256];     // Filename of the white-list
737+
738 /* Used with >= 3.1x */
739 int inwhitelist_q(char* msisdn, char *queuename)
740 {
741Index: smstools/src/whitelist.h
742===================================================================
743--- smstools.orig/src/whitelist.h	2020-07-27 19:00:41.616207603 +0000
744+++ smstools/src/whitelist.h	2020-08-05 19:34:29.959239624 +0000
745@@ -15,7 +15,7 @@
746 #ifndef WHITE_H
747 #define WHITE_H
748
749-char whitelist[256];	// Filename of the white-list
750+extern char whitelist[256];	// Filename of the white-list
751
752 /* Used with >= 3.1x */
753 int inwhitelist_q(char* msisdn, char *queuename);
754