aboutsummaryrefslogtreecommitdiffstats
path: root/src/sim
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2024-04-05 21:51:41 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2024-04-05 21:51:41 +0200
commit6e2fd793ac492c2607f3b1a58f4d8903506103c9 (patch)
tree50261c6782f6252c1d764b3ff460346093d89bc5 /src/sim
parent470fc4934100d44fef1d243ae88a8e100b3947ee (diff)
Increase compiler warnings and fix them
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/Makefile.am2
-rw-r--r--src/sim/main.c13
-rw-r--r--src/sim/sim.c4
-rw-r--r--src/sim/sim.h3
4 files changed, 13 insertions, 9 deletions
diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am
index cffc9d7..1a63b07 100644
--- a/src/sim/Makefile.am
+++ b/src/sim/Makefile.am
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -Wall -Wextra -g $(all_includes)
+AM_CPPFLAGS = -Wall -Wextra -Wmissing-prototypes -g $(all_includes)
bin_PROGRAMS = \
cnetz_sim
diff --git a/src/sim/main.c b/src/sim/main.c
index aa6137f..147967a 100644
--- a/src/sim/main.c
+++ b/src/sim/main.c
@@ -34,6 +34,7 @@
#include "../liboptions/options.h"
#include "../libserial/serial.h"
#include "../libaaimage/aaimage.h"
+#include <osmocom/cc/misc.h>
#include "sim.h"
#include "sniffer.h"
#include "eeprom.h"
@@ -62,7 +63,7 @@ static const char *auth = NULL;
#define TIMEOUT 0.2
-void print_help(const char *arg0)
+static void print_help(const char *arg0)
{
printf("Usage: %s [options] <command>\n", arg0);
/* - - */
@@ -113,7 +114,7 @@ void print_help(const char *arg0)
#define OPT_SONDER 258
#define OPT_WARTUNG 259
-void add_options(void)
+static void add_options(void)
{
option_add('h', "help", 0);
option_add('v', "debug", 1);
@@ -131,7 +132,7 @@ void add_options(void)
option_add('A', "auth", 1);
};
-int handle_options(int short_option, int argi, char **argv)
+static int handle_options(int short_option, int argi, char **argv)
{
int rc;
@@ -228,7 +229,7 @@ size_t eeprom_length(void)
/* main loop for interfacing serial with sim / sniffer */
-int main_loop(serial_t *serial, int sniffer)
+static int main_loop(serial_t *serial, int sniffer)
{
int rc, cts = 0, last_cts = 0;
uint8_t byte;
@@ -312,7 +313,7 @@ int main_loop(serial_t *serial, int sniffer)
return quit;
}
-void sighandler(int sigset)
+static void sighandler(int sigset)
{
if (sigset == SIGHUP)
return;
@@ -501,6 +502,6 @@ error:
return 0;
}
-void osmo_cc_set_log_cat(void) {}
+void osmo_cc_set_log_cat(int __attribute__((unused)) cc_log_cat) {}
#endif /* ARDUINO */
diff --git a/src/sim/sim.c b/src/sim/sim.c
index b6446ae..6b6be97 100644
--- a/src/sim/sim.c
+++ b/src/sim/sim.c
@@ -419,7 +419,7 @@ static int validate_pin(sim_sim_t *sim, uint8_t *data, int length)
/* message buffer handling */
/* get space for return message */
-uint8_t *alloc_msg(sim_sim_t *sim, int size)
+static uint8_t *alloc_msg(sim_sim_t *sim, int size)
{
/* we add 4, because we push 4 bytes (ICL and L2 header later) */
if (size + 4 > (int)sizeof(sim->block_tx_data))
@@ -428,7 +428,7 @@ uint8_t *alloc_msg(sim_sim_t *sim, int size)
}
/* push space in front of a message */
-uint8_t *push_msg(uint8_t *data, int length, int offset)
+static uint8_t *push_msg(uint8_t *data, int length, int offset)
{
int i;
diff --git a/src/sim/sim.h b/src/sim/sim.h
index cc65595..e21bab1 100644
--- a/src/sim/sim.h
+++ b/src/sim/sim.h
@@ -139,6 +139,9 @@ enum l2_cmd {
#define APP_NETZ_C 3
#define APP_RUFN_GEBZ 4
+/* defined for main.c */
+size_t eeprom_length(void);
+
int encode_ebdt(uint8_t *data, const char *futln, const char *sicherung, const char *karten, const char *sonder, const char *wartung);
void decode_ebdt(uint8_t *data, char *futln, char *sicherung, char *karten, char *sonder, char *wartung);
int directory_size(void);