kumquat-buildroot/package/smstools3/0002-fix-build-with-gcc-10.x.patch
Michael Fischer 4c8bb2f87a package/smstools3: fix build with gcc 10.x
0001-fix-build-with-gcc-10.x.patch: Add patch to fix build with gcc 10.x
Fetch from: 57a358a9ee/debian/patches/gcc10.patch

Signed-off-by: Michael Fischer <mf@go-sys.de>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-08-07 21:34:42 +02:00

754 lines
36 KiB
Diff

Description: fix of FTBFS with gcc10
Author: Thorsten Alteholz <debian@alteholz.de>
Fetch from: <https://salsa.debian.org/debian-mobcom-team/smstools/-/blob/57a358a9eebbe2ca5639cc526f7027944ed95ea1/debian/patches/gcc10.patch>
Signed-off-by: Michael Fischer <mf@go-sys.de>
Index: smstools/src/smsd_cfg.h
===================================================================
--- smstools.orig/src/smsd_cfg.h 2020-08-05 19:02:50.536596441 +0000
+++ smstools/src/smsd_cfg.h 2020-08-05 19:33:22.915005150 +0000
@@ -126,17 +126,17 @@
#define ALPHABET_UNKNOWN 4
#define ALPHABET_DEFAULT 0
-char process_title[32]; // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
-int process_id; // -1 for main task, all modems have numbers starting with 0.
+extern char process_title[32]; // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
+extern int process_id; // -1 for main task, all modems have numbers starting with 0.
// This is the same as device, can be used like devices[process_id] if IS_MODEM_PROCESS.
-time_t process_start_time;
+extern time_t process_start_time;
-int modem_handle; // Handle for modem.
+extern int modem_handle; // Handle for modem.
-int put_command_timeouts;
-unsigned long long put_command_sent; // 3.1.16beta.
-char tmpdir[PATH_MAX]; // 3.1.16beta.
+extern int put_command_timeouts;
+extern unsigned long long put_command_sent; // 3.1.16beta.
+extern char tmpdir[PATH_MAX]; // 3.1.16beta.
typedef struct
{
@@ -284,204 +284,204 @@
// NOTE for regular run intervals: effective value is at least delaytime.
-char configfile[PATH_MAX]; // Path to config file
-char d_spool[PATH_MAX]; // Spool directory
-char d_failed[PATH_MAX]; // Failed spool directory
-char d_failed_copy[PATH_MAX]; // 3.1.17.
-char d_incoming[PATH_MAX]; // Incoming spool directory
-char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
-char d_report[PATH_MAX]; // Incoming report spool directory
-char d_report_copy[PATH_MAX]; // 3.1.17.
-char d_phonecalls[PATH_MAX]; // Incoming phonecalls data directory
-char d_saved[PATH_MAX]; // Directory for smsd's internal use, concatenation storage files etc.
-char d_sent[PATH_MAX]; // Sent spool directory
-char d_sent_copy[PATH_MAX]; // 3.1.17.
-char d_checked[PATH_MAX]; // Spool directory for checked messages (only used when no provider queues used)
-char eventhandler[PATH_MAX]; // Global event handler program or script
-char alarmhandler[PATH_MAX]; // Global alarm handler program or script
-char checkhandler[PATH_MAX]; // Handler that checks if the sms file is valid.
-int alarmlevel; // Alarm Level (9=highest). Verbosity of alarm handler.
-char logfile[PATH_MAX]; // Name or Handle of Log File
-int loglevel; // Log Level (9=highest). Verbosity of log file.
-_queue queues[NUMBER_OF_MODEMS]; // Queues
-_device devices[NUMBER_OF_MODEMS]; // Modem devices
-int delaytime; // sleep-time after workless
-int delaytime_mainprocess; // sleep-time after workless, main process. If -1, delaytime is used.
-int blocktime; // sleep-time after multiple errors
-int blockafter; // Block modem after n errors
-int errorsleeptime; // sleep-time after each error
-int autosplit; // Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
-int receive_before_send; // if 1 smsd tries to receive one message before sending
-int store_received_pdu; // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
-int store_sent_pdu; // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
-int validity_period; // Validity period for messages.
-int decode_unicode_text; // 1 if unicode text is decoded internally.
-int internal_combine; // 1 if multipart message is combined internally.
-int internal_combine_binary; // 1 if multipart binary message is combined internally. Defaults to internal_combine.
-int keep_filename; // 0 if unique filename is created to each directory when a message file is moved.
-int store_original_filename; // 1 if an original filename is saved to message file when it's moved from
- // outgoing directory to spooler. Works together with keep_filename.
-int date_filename; // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
-char regular_run[PATH_MAX]; // Script/program which is run regularly.
-int regular_run_interval; // Number of seconds between running a regular_run script/progdam.
-char admin_to[SIZE_TO]; // Destination number for administrative messages.
-int filename_preview; // Number of chars of message text to concatenate to filename.
-int incoming_utf8; // 1 if incoming files are saved using UTF-8 character set.
-int outgoing_utf8; // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
-int log_charconv; // 1 if character set conversion is logged.
-int log_single_lines; // 1 if linefeeds are removed from the modem response to be logged.
-int executable_check; // 0 if eventhandler and other executables are NOT checked during the startup checking.
-int keep_messages; // For testing purposes: messages are not deleted and smsd stops after first run.
-char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
-int ic_purge_hours; // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
-int ic_purge_minutes; // and if there is message parts older than defined, they are handled or deleted.
-int ic_purge_read; // 1 = message parts are stored as single messages. 0 = parts are just deleted.
-int ic_purge_interval; //
-char shell[PATH_MAX]; // Shell used to run eventhandler, defaults to /bin/sh
-char adminmessage_device[32]; // Name of device used to send administrative messages of mainspooler.
-int smart_logging; // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
-int status_signal_quality; // 1 = signal quality is written to status file.
-int status_include_counters; // 1 = succeeded, failed and received counters are included in the status line.
-int status_include_uptime; // 3.1.16beta: 1 = include started & uptime line in the status file.
-int hangup_incoming_call; // 1 = if detected unexpected input contains RING and we want to end call.
-int max_continuous_sending; // Defines when sending is breaked to do check/do other tasks. Time in minutes.
-int voicecall_hangup_ath; // If ATH is used instead of AT+CHUP.
+extern char configfile[PATH_MAX]; // Path to config file
+extern char d_spool[PATH_MAX]; // Spool directory
+extern char d_failed[PATH_MAX]; // Failed spool directory
+extern char d_failed_copy[PATH_MAX]; // 3.1.17.
+extern char d_incoming[PATH_MAX]; // Incoming spool directory
+extern char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
+extern char d_report[PATH_MAX]; // Incoming report spool directory
+extern char d_report_copy[PATH_MAX]; // 3.1.17.
+extern char d_phonecalls[PATH_MAX]; // Incoming phonecalls data directory
+extern char d_saved[PATH_MAX]; // Directory for smsd's internal use, concatenation storage files etc.
+extern char d_sent[PATH_MAX]; // Sent spool directory
+extern char d_sent_copy[PATH_MAX]; // 3.1.17.
+extern char d_checked[PATH_MAX]; // Spool directory for checked messages (only used when no provider queues used)
+extern char eventhandler[PATH_MAX]; // Global event handler program or script
+extern char alarmhandler[PATH_MAX]; // Global alarm handler program or script
+extern char checkhandler[PATH_MAX]; // Handler that checks if the sms file is valid.
+extern int alarmlevel; // Alarm Level (9=highest). Verbosity of alarm handler.
+extern char logfile[PATH_MAX]; // Name or Handle of Log File
+extern int loglevel; // Log Level (9=highest). Verbosity of log file.
+extern _queue queues[NUMBER_OF_MODEMS]; // Queues
+extern _device devices[NUMBER_OF_MODEMS]; // Modem devices
+extern int delaytime; // sleep-time after workless
+extern int delaytime_mainprocess; // sleep-time after workless, main process. If -1, delaytime is used.
+extern int blocktime; // sleep-time after multiple errors
+extern int blockafter; // Block modem after n errors
+extern int errorsleeptime; // sleep-time after each error
+extern int autosplit; // Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
+extern int receive_before_send; // if 1 smsd tries to receive one message before sending
+extern int store_received_pdu; // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
+extern int store_sent_pdu; // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
+extern int validity_period; // Validity period for messages.
+extern int decode_unicode_text; // 1 if unicode text is decoded internally.
+extern int internal_combine; // 1 if multipart message is combined internally.
+extern int internal_combine_binary; // 1 if multipart binary message is combined internally. Defaults to internal_combine.
+extern int keep_filename; // 0 if unique filename is created to each directory when a message file is moved.
+extern int store_original_filename; // 1 if an original filename is saved to message file when it's moved from
+// outgoing directory to spooler. Works together with keep_filename.
+extern int date_filename; // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
+extern char regular_run[PATH_MAX]; // Script/program which is run regularly.
+extern int regular_run_interval; // Number of seconds between running a regular_run script/progdam.
+extern char admin_to[SIZE_TO]; // Destination number for administrative messages.
+extern int filename_preview; // Number of chars of message text to concatenate to filename.
+extern int incoming_utf8; // 1 if incoming files are saved using UTF-8 character set.
+extern int outgoing_utf8; // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
+extern int log_charconv; // 1 if character set conversion is logged.
+extern int log_single_lines; // 1 if linefeeds are removed from the modem response to be logged.
+extern int executable_check; // 0 if eventhandler and other executables are NOT checked during the startup checking.
+extern int keep_messages; // For testing purposes: messages are not deleted and smsd stops after first run.
+extern char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
+extern int ic_purge_hours; // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
+extern int ic_purge_minutes; // and if there is message parts older than defined, they are handled or deleted.
+extern int ic_purge_read; // 1 = message parts are stored as single messages. 0 = parts are just deleted.
+extern int ic_purge_interval; //
+extern char shell[PATH_MAX]; // Shell used to run eventhandler, defaults to /bin/sh
+extern char adminmessage_device[32]; // Name of device used to send administrative messages of mainspooler.
+extern int smart_logging; // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
+extern int status_signal_quality; // 1 = signal quality is written to status file.
+extern int status_include_counters; // 1 = succeeded, failed and received counters are included in the status line.
+extern int status_include_uptime; // 3.1.16beta: 1 = include started & uptime line in the status file.
+extern int hangup_incoming_call; // 1 = if detected unexpected input contains RING and we want to end call.
+extern int max_continuous_sending; // Defines when sending is breaked to do check/do other tasks. Time in minutes.
+extern int voicecall_hangup_ath; // If ATH is used instead of AT+CHUP.
// 3.1.5:
-int trust_outgoing; // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
+extern int trust_outgoing; // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
// 3.1.5:
-int ignore_outgoing_priority; // 1 = Priority: high header is not checked. Speeds up spooling.
+extern int ignore_outgoing_priority; // 1 = Priority: high header is not checked. Speeds up spooling.
// 3.1.7:
-int ignore_exec_output; // 1 = stdout and stderr of eventhandlers is _not_ checked.
+extern int ignore_exec_output; // 1 = stdout and stderr of eventhandlers is _not_ checked.
// 3.1.7:
-mode_t conf_umask; // File mode creation mask for smsd and modem processes.
+extern mode_t conf_umask; // File mode creation mask for smsd and modem processes.
// 3.1.7:
-int trim_text; // 1 = trailing whitespaces are removed from text:
+extern int trim_text; // 1 = trailing whitespaces are removed from text:
// 3.1.7:
-int use_linux_ps_trick; // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
+extern int use_linux_ps_trick; // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
// 3.1.7:
-int log_unmodified;
+extern int log_unmodified;
// 3.1.7:
-char suspend_filename[PATH_MAX];
+extern char suspend_filename[PATH_MAX];
// 3.1.9:
-int spool_directory_order;
+extern int spool_directory_order;
// 3.1.9: 1 if read_from_modem is logged.
-int log_read_from_modem;
+extern int log_read_from_modem;
// 3.1.16beta2: log_read_timing for performance tuning.
-int log_read_timing;
+extern int log_read_timing;
// 3.1.16beta:
-int log_response_time;
+extern int log_response_time;
// 3.1.16beta2:
-int default_alphabet;
+extern int default_alphabet;
// 3.1.17: Child process for the mainprocess:
-char mainprocess_child[PATH_MAX];
-char mainprocess_child_args[PATH_MAX];
+extern char mainprocess_child[PATH_MAX];
+extern char mainprocess_child_args[PATH_MAX];
// 3.1.17: Notifier for the mainprocess:
-int mainprocess_notifier;
+extern int mainprocess_notifier;
// 3.1.17: If *_copy was made, evenhandler can use it instead of original file:
-int eventhandler_use_copy;
+extern int eventhandler_use_copy;
// 3.1.17: This defines how long to sleep while looping:
-int sleeptime_mainprocess;
+extern int sleeptime_mainprocess;
// 3.1.17: Defines how often PID is checked to detect if another smsd is running:
-int check_pid_interval;
+extern int check_pid_interval;
// 3.1.18: start script/program for mainprocess:
-char mainprocess_start[PATH_MAX];
-char mainprocess_start_args[PATH_MAX];
+extern char mainprocess_start[PATH_MAX];
+extern char mainprocess_start_args[PATH_MAX];
-int message_count; // Counter for sent messages. Multipart message is one message.
+extern int message_count; // Counter for sent messages. Multipart message is one message.
-volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
-volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
+extern volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
+extern volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
-char username[65]; // user and group name which are used to run.
-char groupname[65]; // (max length is just a guess)
+extern char username[65]; // user and group name which are used to run.
+extern char groupname[65]; // (max length is just a guess)
-char infofile[PATH_MAX]; // Hepler file for stopping the smsd smoothly.
-char pidfile[PATH_MAX]; // File where a process id is stored.
+extern char infofile[PATH_MAX]; // Hepler file for stopping the smsd smoothly.
+extern char pidfile[PATH_MAX]; // File where a process id is stored.
// Command line arguments:
-char arg_username[65];
-char arg_groupname[65];
-char arg_infofile[PATH_MAX];
-char arg_pidfile[PATH_MAX];
-char arg_logfile[PATH_MAX];
-int arg_terminal;
+extern char arg_username[65];
+extern char arg_groupname[65];
+extern char arg_infofile[PATH_MAX];
+extern char arg_pidfile[PATH_MAX];
+extern char arg_logfile[PATH_MAX];
+extern int arg_terminal;
// 3.1.7:
-char arg_7bit_packed[512];
-int do_encode_decode_arg_7bit_packed;
+extern char arg_7bit_packed[512];
+extern int do_encode_decode_arg_7bit_packed;
-int terminal; // 1 if smsd is communicating with terminal.
-pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
-char run_info[PATH_MAX]; // Information about external script/program execution.
+extern int terminal; // 1 if smsd is communicating with terminal.
+extern pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
+extern char run_info[PATH_MAX]; // Information about external script/program execution.
-char communicate[32]; // Device name for terminal communication mode.
+extern char communicate[32]; // Device name for terminal communication mode.
-char international_prefixes[PATH_MAX +1];
-char national_prefixes[PATH_MAX +1];
+extern char international_prefixes[PATH_MAX +1];
+extern char national_prefixes[PATH_MAX +1];
// Storage for startup errors:
-char *startup_err_str;
-int startup_err_count;
+extern char *startup_err_str;
+extern int startup_err_count;
// Storage for PDU's:
-char *incoming_pdu_store;
-char *outgoing_pdu_store;
-char *routed_pdu_store;
+extern char *incoming_pdu_store;
+extern char *outgoing_pdu_store;
+extern char *routed_pdu_store;
// Storage for getfile errors:
-char *getfile_err_store;
+extern char *getfile_err_store;
// Text buffer for error messages:
-char tb[SIZE_TB];
+extern char tb[SIZE_TB];
// Buffer for SIM memory checking:
-char *check_memory_buffer;
-size_t check_memory_buffer_size;
+extern char *check_memory_buffer;
+extern size_t check_memory_buffer_size;
-int os_cygwin; // 1 if we are on Cygwin.
+extern int os_cygwin; // 1 if we are on Cygwin.
-char language_file[PATH_MAX]; // File name of translated headers.
-char yes_chars[SIZE_HEADER]; // Characters which mean "yes" in the yesno() question.
-char no_chars[SIZE_HEADER]; // See details inside read_translation() function.
-char yes_word[SIZE_HEADER]; // "yes" printed as an output.
-char no_word[SIZE_HEADER]; // "no"
-char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
-char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
-char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
-int translate_incoming; // 0 if incoming message headers are NOT transtaled.
+extern char language_file[PATH_MAX]; // File name of translated headers.
+extern char yes_chars[SIZE_HEADER]; // Characters which mean "yes" in the yesno() question.
+extern char no_chars[SIZE_HEADER]; // See details inside read_translation() function.
+extern char yes_word[SIZE_HEADER]; // "yes" printed as an output.
+extern char no_word[SIZE_HEADER]; // "no"
+extern char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
+extern char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
+extern char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
+extern int translate_incoming; // 0 if incoming message headers are NOT transtaled.
// 3.1.14:
-int logtime_us;
-int logtime_ms;
+extern int logtime_us;
+extern int logtime_ms;
// 3.1.14:
-int shell_test;
+extern int shell_test;
// Next two are for debugging purposes:
-int enable_smsd_debug;
-char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
+extern int enable_smsd_debug;
+extern char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
// 3.1.20: Alt keys in communication mode:
#define COMMUNICATE_A_KEY_COUNT 10
-char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
+extern char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
/* initialize all variable with default values */
Index: smstools/src/smsd_cfg.c
===================================================================
--- smstools.orig/src/smsd_cfg.c 2020-07-27 19:00:41.616207603 +0000
+++ smstools/src/smsd_cfg.c 2020-08-05 19:17:41.595712888 +0000
@@ -38,6 +38,221 @@
#include "modeminit.h"
#include "charshift.h"
+
+/* global variables */
+char process_title[32]; // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
+int process_id; // -1 for main task, all modems have numbers starting with 0.
+ // This is the same as device, can be used like devices[process_id] if IS_MODEM_PROCESS.
+
+time_t process_start_time;
+
+int modem_handle; // Handle for modem.
+
+int put_command_timeouts;
+unsigned long long put_command_sent; // 3.1.16beta.
+char tmpdir[PATH_MAX]; // 3.1.16beta.
+
+// NOTE for regular run intervals: effective value is at least delaytime.
+
+char configfile[PATH_MAX]; // Path to config file
+char d_spool[PATH_MAX]; // Spool directory
+char d_failed[PATH_MAX]; // Failed spool directory
+char d_failed_copy[PATH_MAX]; // 3.1.17.
+char d_incoming[PATH_MAX]; // Incoming spool directory
+char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
+char d_report[PATH_MAX]; // Incoming report spool directory
+char d_report_copy[PATH_MAX]; // 3.1.17.
+char d_phonecalls[PATH_MAX]; // Incoming phonecalls data directory
+char d_saved[PATH_MAX]; // Directory for smsd's internal use, concatenation storage files etc.
+char d_sent[PATH_MAX]; // Sent spool directory
+char d_sent_copy[PATH_MAX]; // 3.1.17.
+char d_checked[PATH_MAX]; // Spool directory for checked messages (only used when no provider queues used)
+char eventhandler[PATH_MAX]; // Global event handler program or script
+char alarmhandler[PATH_MAX]; // Global alarm handler program or script
+char checkhandler[PATH_MAX]; // Handler that checks if the sms file is valid.
+int alarmlevel; // Alarm Level (9=highest). Verbosity of alarm handler.
+char logfile[PATH_MAX]; // Name or Handle of Log File
+int loglevel; // Log Level (9=highest). Verbosity of log file.
+_queue queues[NUMBER_OF_MODEMS]; // Queues
+_device devices[NUMBER_OF_MODEMS]; // Modem devices
+int delaytime; // sleep-time after workless
+int delaytime_mainprocess; // sleep-time after workless, main process. If -1, delaytime is used.
+int blocktime; // sleep-time after multiple errors
+int blockafter; // Block modem after n errors
+int errorsleeptime; // sleep-time after each error
+int autosplit; // Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
+int receive_before_send; // if 1 smsd tries to receive one message before sending
+int store_received_pdu; // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
+int store_sent_pdu; // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
+int validity_period; // Validity period for messages.
+int decode_unicode_text; // 1 if unicode text is decoded internally.
+int internal_combine; // 1 if multipart message is combined internally.
+int internal_combine_binary; // 1 if multipart binary message is combined internally. Defaults to internal_combine.
+int keep_filename; // 0 if unique filename is created to each directory when a message file is moved.
+int store_original_filename; // 1 if an original filename is saved to message file when it's moved from
+ // outgoing directory to spooler. Works together with keep_filename.
+int date_filename; // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
+char regular_run[PATH_MAX]; // Script/program which is run regularly.
+int regular_run_interval; // Number of seconds between running a regular_run script/progdam.
+char admin_to[SIZE_TO]; // Destination number for administrative messages.
+int filename_preview; // Number of chars of message text to concatenate to filename.
+int incoming_utf8; // 1 if incoming files are saved using UTF-8 character set.
+int outgoing_utf8; // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
+int log_charconv; // 1 if character set conversion is logged.
+int log_single_lines; // 1 if linefeeds are removed from the modem response to be logged.
+int executable_check; // 0 if eventhandler and other executables are NOT checked during the startup checking.
+int keep_messages; // For testing purposes: messages are not deleted and smsd stops after first run.
+char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
+int ic_purge_hours; // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
+int ic_purge_minutes; // and if there is message parts older than defined, they are handled or deleted.
+int ic_purge_read; // 1 = message parts are stored as single messages. 0 = parts are just deleted.
+int ic_purge_interval; //
+char shell[PATH_MAX]; // Shell used to run eventhandler, defaults to /bin/sh
+char adminmessage_device[32]; // Name of device used to send administrative messages of mainspooler.
+int smart_logging; // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
+int status_signal_quality; // 1 = signal quality is written to status file.
+int status_include_counters; // 1 = succeeded, failed and received counters are included in the status line.
+int status_include_uptime; // 3.1.16beta: 1 = include started & uptime line in the status file.
+int hangup_incoming_call; // 1 = if detected unexpected input contains RING and we want to end call.
+int max_continuous_sending; // Defines when sending is breaked to do check/do other tasks. Time in minutes.
+int voicecall_hangup_ath; // If ATH is used instead of AT+CHUP.
+
+// 3.1.5:
+int trust_outgoing; // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
+
+// 3.1.5:
+int ignore_outgoing_priority; // 1 = Priority: high header is not checked. Speeds up spooling.
+
+// 3.1.7:
+int ignore_exec_output; // 1 = stdout and stderr of eventhandlers is _not_ checked.
+
+// 3.1.7:
+mode_t conf_umask; // File mode creation mask for smsd and modem processes.
+
+// 3.1.7:
+int trim_text; // 1 = trailing whitespaces are removed from text:
+
+// 3.1.7:
+int use_linux_ps_trick; // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
+
+// 3.1.7:
+int log_unmodified;
+
+// 3.1.7:
+char suspend_filename[PATH_MAX];
+
+// 3.1.9:
+int spool_directory_order;
+
+// 3.1.9: 1 if read_from_modem is logged.
+int log_read_from_modem;
+
+// 3.1.16beta2: log_read_timing for performance tuning.
+int log_read_timing;
+
+// 3.1.16beta:
+int log_response_time;
+
+// 3.1.16beta2:
+int default_alphabet;
+
+// 3.1.17: Child process for the mainprocess:
+char mainprocess_child[PATH_MAX];
+char mainprocess_child_args[PATH_MAX];
+
+// 3.1.17: Notifier for the mainprocess:
+int mainprocess_notifier;
+
+// 3.1.17: If *_copy was made, evenhandler can use it instead of original file:
+int eventhandler_use_copy;
+
+// 3.1.17: This defines how long to sleep while looping:
+int sleeptime_mainprocess;
+
+// 3.1.17: Defines how often PID is checked to detect if another smsd is running:
+int check_pid_interval;
+
+// 3.1.18: start script/program for mainprocess:
+char mainprocess_start[PATH_MAX];
+char mainprocess_start_args[PATH_MAX];
+
+int message_count; // Counter for sent messages. Multipart message is one message.
+
+volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
+volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
+
+char username[65]; // user and group name which are used to run.
+char groupname[65]; // (max length is just a guess)
+
+char infofile[PATH_MAX]; // Hepler file for stopping the smsd smoothly.
+char pidfile[PATH_MAX]; // File where a process id is stored.
+
+// Command line arguments:
+char arg_username[65];
+char arg_groupname[65];
+char arg_infofile[PATH_MAX];
+char arg_pidfile[PATH_MAX];
+char arg_logfile[PATH_MAX];
+int arg_terminal;
+// 3.1.7:
+char arg_7bit_packed[512];
+int do_encode_decode_arg_7bit_packed;
+
+int terminal; // 1 if smsd is communicating with terminal.
+pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
+char run_info[PATH_MAX]; // Information about external script/program execution.
+
+char communicate[32]; // Device name for terminal communication mode.
+
+char international_prefixes[PATH_MAX +1];
+char national_prefixes[PATH_MAX +1];
+
+// Storage for startup errors:
+char *startup_err_str;
+int startup_err_count;
+
+// Storage for PDU's:
+char *incoming_pdu_store;
+char *outgoing_pdu_store;
+char *routed_pdu_store;
+
+// Storage for getfile errors:
+char *getfile_err_store;
+
+// Text buffer for error messages:
+char tb[SIZE_TB];
+
+// Buffer for SIM memory checking:
+char *check_memory_buffer;
+size_t check_memory_buffer_size;
+
+int os_cygwin; // 1 if we are on Cygwin.
+
+char language_file[PATH_MAX]; // File name of translated headers.
+char yes_chars[SIZE_HEADER]; // Characters which mean "yes" in the yesno() question.
+char no_chars[SIZE_HEADER]; // See details inside read_translation() function.
+char yes_word[SIZE_HEADER]; // "yes" printed as an output.
+char no_word[SIZE_HEADER]; // "no"
+char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
+char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
+char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
+int translate_incoming; // 0 if incoming message headers are NOT transtaled.
+
+// 3.1.14:
+int logtime_us;
+int logtime_ms;
+
+// 3.1.14:
+int shell_test;
+
+// Next two are for debugging purposes:
+int enable_smsd_debug;
+char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
+
+// 3.1.20: Alt keys in communication mode:
+#define COMMUNICATE_A_KEY_COUNT 10
+char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
+
char *msg_dir = "%s directory %s cannot be opened.";
char *msg_file = "%s directory %s is not writable.";
char *msg_not_executable = "is not executable for smsd.";
Index: smstools/src/logging.c
===================================================================
--- smstools.orig/src/logging.c 2020-07-27 19:00:41.612207583 +0000
+++ smstools/src/logging.c 2020-08-05 19:27:38.373800111 +0000
@@ -25,6 +25,16 @@
#include "smsd_cfg.h"
#include "stats.h"
+
+// 3.1.16beta2: Moved logch() and prch() from charset.c to logging.c:
+char logch_buffer[8192];
+
+char prch(char ch);
+
+// 3.1.16beta: changed type:
+//int trouble_logging_started;
+time_t trouble_logging_started;
+
int Filehandle = -1;
int Level;
int SavedLevel;
Index: smstools/src/logging.h
===================================================================
--- smstools.orig/src/logging.h 2020-07-27 19:00:41.612207583 +0000
+++ smstools/src/logging.h 2020-08-05 19:27:52.077848035 +0000
@@ -18,7 +18,7 @@
#include <time.h>
// 3.1.16beta2: Moved logch() and prch() from charset.c to logging.c:
-char logch_buffer[8192];
+extern char logch_buffer[8192];
#ifdef __GNUC__
void logch(char* format, ...) __attribute__ ((format(printf, 1, 2)));
@@ -26,11 +26,11 @@
void logch(char* format, ...);
#endif
-char prch(char ch);
+extern char prch(char ch);
// 3.1.16beta: changed type:
//int trouble_logging_started;
-time_t trouble_logging_started;
+extern time_t trouble_logging_started;
int change_loglevel(int new_level);
void restore_loglevel();
Index: smstools/src/stats.c
===================================================================
--- smstools.orig/src/stats.c 2020-07-27 19:00:41.616207603 +0000
+++ smstools/src/stats.c 2020-08-05 19:28:58.094078936 +0000
@@ -29,6 +29,20 @@
#include <mm.h>
#endif
+
+_stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
+int rejected_counter; // Statistic counter, rejected SM, number does not fit into any queue
+time_t start_time; // Start time of smsd, allows statistic functions
+int printstatus; // if 1 smsd outputs status on stdout
+time_t last_stats; // time when the last stats file was created
+char d_stats[PATH_MAX]; // path to statistic files
+int stats_interval; // time between statistic files in seconds.
+int stats_no_zeroes; // Suppress files that contain only zeroes
+int status_interval; // time between updating status file in seconds
+
+char *shared_buffer;
+
+
char newstatus[NUMBER_OF_MODEMS +1] = {0};
char oldstatus[NUMBER_OF_MODEMS +1] = {0};
Index: smstools/src/stats.h
===================================================================
--- smstools.orig/src/stats.h 2020-07-27 19:00:41.616207603 +0000
+++ smstools/src/stats.h 2020-08-05 19:29:14.750137182 +0000
@@ -33,17 +33,17 @@
int ber;
} _stats;
-_stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
-int rejected_counter; // Statistic counter, rejected SM, number does not fit into any queue
-time_t start_time; // Start time of smsd, allows statistic functions
-int printstatus; // if 1 smsd outputs status on stdout
-time_t last_stats; // time when the last stats file was created
-char d_stats[PATH_MAX]; // path to statistic files
-int stats_interval; // time between statistic files in seconds.
-int stats_no_zeroes; // Suppress files that contain only zeroes
-int status_interval; // time between updating status file in seconds
+extern _stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
+extern int rejected_counter; // Statistic counter, rejected SM, number does not fit into any queue
+extern time_t start_time; // Start time of smsd, allows statistic functions
+extern int printstatus; // if 1 smsd outputs status on stdout
+extern time_t last_stats; // time when the last stats file was created
+extern char d_stats[PATH_MAX]; // path to statistic files
+extern int stats_interval; // time between statistic files in seconds.
+extern int stats_no_zeroes; // Suppress files that contain only zeroes
+extern int status_interval; // time between updating status file in seconds
-char *shared_buffer;
+extern char *shared_buffer;
/* Creates shared memory variables for statistic data */
Index: smstools/src/blacklist.c
===================================================================
--- smstools.orig/src/blacklist.c 2020-07-27 19:00:41.612207583 +0000
+++ smstools/src/blacklist.c 2020-08-05 19:34:13.903183463 +0000
@@ -23,6 +23,8 @@
#include "alarm.h"
#include "smsd_cfg.h"
+char blacklist[256]; // Filename of the black-list
+
int inblacklist(char* msisdn)
{
FILE* file;
Index: smstools/src/blacklist.h
===================================================================
--- smstools.orig/src/blacklist.h 2020-07-27 19:00:41.612207583 +0000
+++ smstools/src/blacklist.h 2020-08-05 19:34:04.903151994 +0000
@@ -15,7 +15,7 @@
#ifndef BLACK_H
#define BLACK_H
-char blacklist[256]; // Filename of the black-list
+extern char blacklist[256]; // Filename of the black-list
int inblacklist(char* msisdn);
Index: smstools/src/whitelist.c
===================================================================
--- smstools.orig/src/whitelist.c 2020-07-27 19:00:41.616207603 +0000
+++ smstools/src/whitelist.c 2020-08-05 19:39:23.436266057 +0000
@@ -23,6 +23,8 @@
#include "alarm.h"
#include "smsd_cfg.h"
+char whitelist[256]; // Filename of the white-list
+
/* Used with >= 3.1x */
int inwhitelist_q(char* msisdn, char *queuename)
{
Index: smstools/src/whitelist.h
===================================================================
--- smstools.orig/src/whitelist.h 2020-07-27 19:00:41.616207603 +0000
+++ smstools/src/whitelist.h 2020-08-05 19:34:29.959239624 +0000
@@ -15,7 +15,7 @@
#ifndef WHITE_H
#define WHITE_H
-char whitelist[256]; // Filename of the white-list
+extern char whitelist[256]; // Filename of the white-list
/* Used with >= 3.1x */
int inwhitelist_q(char* msisdn, char *queuename);