mirror of https://github.com/wb2osz/direwolf.git
Cleanups
This commit is contained in:
parent
dcabb8f7a5
commit
89021dd50c
38
src/config.c
38
src/config.c
|
@ -4896,19 +4896,19 @@ void config_init (char *fname, struct audio_s *p_audio_config,
|
|||
for ( ; *t != '\0' ; t++ ) {
|
||||
switch (toupper(*t)) {
|
||||
case 'N':
|
||||
p_misc_config->waypoint_formats |= WPT_FORMAT_NMEA_GENERIC;
|
||||
p_misc_config->waypoint_formats |= WPL_FORMAT_NMEA_GENERIC;
|
||||
break;
|
||||
case 'G':
|
||||
p_misc_config->waypoint_formats |= WPT_FORMAT_GARMIN;
|
||||
p_misc_config->waypoint_formats |= WPL_FORMAT_GARMIN;
|
||||
break;
|
||||
case 'M':
|
||||
p_misc_config->waypoint_formats |= WPT_FORMAT_MAGELLAN;
|
||||
p_misc_config->waypoint_formats |= WPL_FORMAT_MAGELLAN;
|
||||
break;
|
||||
case 'K':
|
||||
p_misc_config->waypoint_formats |= WPT_FORMAT_KENWOOD;
|
||||
p_misc_config->waypoint_formats |= WPL_FORMAT_KENWOOD;
|
||||
break;
|
||||
case 'A':
|
||||
p_misc_config->waypoint_formats |= WPT_FORMAT_AIS;
|
||||
p_misc_config->waypoint_formats |= WPL_FORMAT_AIS;
|
||||
break;
|
||||
case ' ':
|
||||
case ',':
|
||||
|
@ -5470,6 +5470,10 @@ void config_init (char *fname, struct audio_s *p_audio_config,
|
|||
* Returns 1 for success, 0 for serious error.
|
||||
*/
|
||||
|
||||
// FIXME: provide error messages when non applicable option is used for particular beacon type.
|
||||
// e.g. IBEACON DELAY=1 EVERY=1 SENDTO=IG OVERLAY=R SYMBOL="igate" LAT=37^44.46N LONG=122^27.19W COMMENT="N1KOL-1 IGATE"
|
||||
// Just ignores overlay, symbol, lat, long, and comment.
|
||||
|
||||
static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_s *p_audio_config)
|
||||
{
|
||||
char *t;
|
||||
|
@ -5643,8 +5647,28 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
|
|||
}
|
||||
else if (strcasecmp(keyword, "ALT") == 0 || strcasecmp(keyword, "ALTITUDE") == 0) {
|
||||
|
||||
// TODO: allow units.
|
||||
b->alt_m = atof(value);
|
||||
char *unit = strpbrk(value, "abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
if (unit != NULL) {
|
||||
float meters = 0;
|
||||
for (int j=0; j<NUM_UNITS && meters == 0; j++) {
|
||||
if (strcasecmp(units[j].name, unit) == 0) {
|
||||
meters = units[j].meters;
|
||||
}
|
||||
}
|
||||
if (meters == 0) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("Line %d: Unrecognized unit '%s' for altitude. Using meter.\n", line, unit);
|
||||
dw_printf ("Try using singular form. e.g. ft or foot rather than feet.\n");
|
||||
b->alt_m = atof(value);
|
||||
}
|
||||
else {
|
||||
// valid unit
|
||||
b->alt_m = atof(value) * meters;
|
||||
}
|
||||
} else {
|
||||
// no unit specified
|
||||
b->alt_m = atof(value);
|
||||
}
|
||||
}
|
||||
else if (strcasecmp(keyword, "ZONE") == 0) {
|
||||
strlcpy(zone, value, sizeof(zone));
|
||||
|
|
10
src/config.h
10
src/config.h
|
@ -98,11 +98,11 @@ struct misc_config_s {
|
|||
|
||||
int waypoint_formats; /* Which sentence formats should be generated? */
|
||||
|
||||
#define WPT_FORMAT_NMEA_GENERIC 0x01 /* N $GPWPT */
|
||||
#define WPT_FORMAT_GARMIN 0x02 /* G $PGRMW */
|
||||
#define WPT_FORMAT_MAGELLAN 0x04 /* M $PMGNWPL */
|
||||
#define WPT_FORMAT_KENWOOD 0x08 /* K $PKWDWPL */
|
||||
#define WPT_FORMAT_AIS 0x10 /* A !AIVDM */
|
||||
#define WPL_FORMAT_NMEA_GENERIC 0x01 /* N $GPWPL */
|
||||
#define WPL_FORMAT_GARMIN 0x02 /* G $PGRMW */
|
||||
#define WPL_FORMAT_MAGELLAN 0x04 /* M $PMGNWPL */
|
||||
#define WPL_FORMAT_KENWOOD 0x08 /* K $PKWDWPL */
|
||||
#define WPL_FORMAT_AIS 0x10 /* A !AIVDM */
|
||||
|
||||
|
||||
int log_daily_names; /* True to generate new log file each day. */
|
||||
|
|
|
@ -38,6 +38,12 @@ struct digi_config_s {
|
|||
|
||||
enum preempt_e { PREEMPT_OFF, PREEMPT_DROP, PREEMPT_MARK, PREEMPT_TRACE } preempt[MAX_CHANS][MAX_CHANS];
|
||||
|
||||
// NOID is an ugly hack for the specific need of ATGP which needs more that 8 digipeaters.
|
||||
// The via path starts out as HOP7-7,HOP7-7 and we do not want tracing so it does not fill up.
|
||||
// DO NOT put this in the User Guide. On a need to know basis.
|
||||
|
||||
char noid[MAX_CHANS][MAX_CHANS][AX25_MAX_ADDR_LEN];
|
||||
|
||||
char *filter_str[MAX_CHANS+1][MAX_CHANS+1];
|
||||
// NULL or optional Packet Filter strings such as "t/m".
|
||||
// Notice the size of arrays is one larger than normal.
|
||||
|
|
|
@ -299,7 +299,7 @@ int main (int argc, char *argv[])
|
|||
text_color_init(t_opt);
|
||||
text_color_set(DW_COLOR_INFO);
|
||||
//dw_printf ("Dire Wolf version %d.%d (%s) Beta Test 4\n", MAJOR_VERSION, MINOR_VERSION, __DATE__);
|
||||
dw_printf ("Dire Wolf DEVELOPMENT version %d.%d %s (%s)\n", MAJOR_VERSION, MINOR_VERSION, "C", __DATE__);
|
||||
dw_printf ("Dire Wolf DEVELOPMENT version %d.%d %s (%s)\n", MAJOR_VERSION, MINOR_VERSION, "D", __DATE__);
|
||||
//dw_printf ("Dire Wolf version %d.%d\n", MAJOR_VERSION, MINOR_VERSION);
|
||||
|
||||
|
||||
|
|
63
src/dlq.c
63
src/dlq.c
|
@ -130,12 +130,18 @@ void dlq_init (void)
|
|||
#else
|
||||
int err;
|
||||
err = pthread_mutex_init (&wake_up_mutex, NULL);
|
||||
if (err != 0) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("dlq_init: pthread_mutex_init err=%d", err);
|
||||
perror ("");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
err = pthread_mutex_init (&dlq_mutex, NULL);
|
||||
if (err != 0) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("dlq_init: pthread_mutex_init err=%d", err);
|
||||
perror ("");
|
||||
exit (1);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -253,6 +259,11 @@ void dlq_rec_frame (int chan, int subchan, int slice, packet_t pp, alevel_t alev
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
if (s_new_count > s_delete_count + 50) {
|
||||
|
@ -492,6 +503,11 @@ void dlq_connect_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int num
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_CONNECT_REQUEST;
|
||||
|
@ -545,6 +561,11 @@ void dlq_disconnect_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_DISCONNECT_REQUEST;
|
||||
|
@ -603,6 +624,11 @@ void dlq_outstanding_frames_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LE
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_OUTSTANDING_FRAMES_REQUEST;
|
||||
|
@ -670,6 +696,11 @@ void dlq_xmit_data_request (char addrs[AX25_MAX_ADDRS][AX25_MAX_ADDR_LEN], int n
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_XMIT_DATA_REQUEST;
|
||||
|
@ -733,6 +764,11 @@ void dlq_register_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client)
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_REGISTER_CALLSIGN;
|
||||
|
@ -763,6 +799,11 @@ void dlq_unregister_callsign (char addr[AX25_MAX_ADDR_LEN], int chan, int client
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_UNREGISTER_CALLSIGN;
|
||||
|
@ -817,6 +858,11 @@ void dlq_channel_busy (int chan, int activity, int status)
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_CHANNEL_BUSY;
|
||||
|
@ -865,6 +911,11 @@ void dlq_seize_confirm (int chan)
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
pnew->type = DLQ_SEIZE_CONFIRM;
|
||||
|
@ -910,6 +961,11 @@ void dlq_client_cleanup (int client)
|
|||
/* Allocate a new queue item. */
|
||||
|
||||
pnew = (struct dlq_item_s *) calloc (sizeof(struct dlq_item_s), 1);
|
||||
if (pnew == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
s_new_count++;
|
||||
|
||||
// All we care about is the client number.
|
||||
|
@ -1192,6 +1248,11 @@ cdata_t *cdata_new (int pid, char *data, int len)
|
|||
size = ( len + 127 ) & ~0x7f;
|
||||
|
||||
cdata = malloc ( sizeof(cdata_t) + size );
|
||||
if (cdata == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
cdata->magic = TXDATA_MAGIC;
|
||||
cdata->next = NULL;
|
||||
|
|
|
@ -263,6 +263,11 @@ void kissnet_init (struct misc_config_s *mc)
|
|||
for (int i = 0; i < MAX_KISS_TCP_PORTS; i++) {
|
||||
if (mc->kiss_port[i] != 0) {
|
||||
struct kissport_status_s *kps = calloc(sizeof(struct kissport_status_s), 1);
|
||||
if (kps == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
kps->tcp_port = mc->kiss_port[i];
|
||||
kps->chan = mc->kiss_chan[i];
|
||||
|
|
|
@ -258,8 +258,6 @@ static void read_csv(FILE *fp)
|
|||
float speed = UNKNOWN_VALUE;
|
||||
float course = UNKNOWN_VALUE;
|
||||
float alt = UNKNOWN_VALUE;
|
||||
double freq = UNKNOWN_VALUE;
|
||||
int offset = UNKNOWN_VALUE;
|
||||
char stemp[16], desc[32], comment[256];
|
||||
|
||||
if (pspeed != NULL && strlen(pspeed) > 0) {
|
||||
|
@ -275,7 +273,7 @@ static void read_csv(FILE *fp)
|
|||
/* combine freq/offset/tone into one description string. */
|
||||
|
||||
if (pfreq != NULL && strlen(pfreq) > 0) {
|
||||
freq = atof(pfreq);
|
||||
double freq = atof(pfreq);
|
||||
snprintf (desc, sizeof(desc), "%.3f MHz", freq);
|
||||
}
|
||||
else {
|
||||
|
@ -283,7 +281,7 @@ static void read_csv(FILE *fp)
|
|||
}
|
||||
|
||||
if (poffset != NULL && strlen(poffset) > 0) {
|
||||
offset = atoi(poffset);
|
||||
int offset = atoi(poffset);
|
||||
if (offset != 0 && offset % 1000 == 0) {
|
||||
snprintf (stemp, sizeof(stemp), "%+dM", offset / 1000);
|
||||
}
|
||||
|
|
10
src/mheard.c
10
src/mheard.c
|
@ -350,6 +350,11 @@ void mheard_save_rf (int chan, decode_aprs_t *A, packet_t pp, alevel_t alevel, r
|
|||
}
|
||||
|
||||
mptr = calloc(sizeof(mheard_t),1);
|
||||
if (mptr == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
strlcpy (mptr->callsign, source, sizeof(mptr->callsign));
|
||||
mptr->count = 1;
|
||||
mptr->chan = chan;
|
||||
|
@ -485,6 +490,11 @@ void mheard_save_is (char *ptext)
|
|||
}
|
||||
|
||||
mptr = calloc(sizeof(mheard_t),1);
|
||||
if (mptr == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
strlcpy (mptr->callsign, source, sizeof(mptr->callsign));
|
||||
mptr->count = 1;
|
||||
mptr->last_heard_is = now;
|
||||
|
|
|
@ -88,7 +88,11 @@ rrbb_t rrbb_new (int chan, int subchan, int slice, int is_scrambled, int descram
|
|||
assert (slice >= 0 && slice < MAX_SLICERS);
|
||||
|
||||
result = malloc(sizeof(struct rrbb_s));
|
||||
|
||||
if (result == NULL) {
|
||||
text_color_set(DW_COLOR_ERROR);
|
||||
dw_printf ("FATAL ERROR: Out of memory.\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
result->magic1 = MAGIC1;
|
||||
result->chan = chan;
|
||||
result->subchan = subchan;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// This file is part of Dire Wolf, an amateur radio packet TNC.
|
||||
//
|
||||
// Copyright (C) 2011, 2012, 2013, 2014, 2015 John Langner, WB2OSZ
|
||||
// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2022 John Langner, WB2OSZ
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
@ -556,6 +556,7 @@ static const char ssid_to_sym[16] = {
|
|||
'v' /* 15 - Van */
|
||||
};
|
||||
|
||||
|
||||
void symbols_from_dest_or_src (char dti, char *src, char *dest, char *symtab, char *symbol)
|
||||
{
|
||||
char *p;
|
||||
|
@ -663,16 +664,30 @@ void symbols_from_dest_or_src (char dti, char *src, char *dest, char *symtab, ch
|
|||
* Chapter 20, "Symbol in the Source Address SSID"
|
||||
*/
|
||||
|
||||
p = strchr (src, '-');
|
||||
if (p != NULL)
|
||||
{
|
||||
int ssid;
|
||||
// January 2022 - Every time this shows up, it confuses people terribly.
|
||||
// e.g. An APRS "message" shows up with Bus or Motorcycle in the description.
|
||||
|
||||
ssid = atoi(p+1);
|
||||
if (ssid >= 1 && ssid <= 15) {
|
||||
*symtab = '/'; /* All in Primary table. */
|
||||
*symbol = ssid_to_sym[ssid];
|
||||
return;
|
||||
// The position and object formats all contain a proper symbol and table.
|
||||
// There doesn't seem to be much reason to have a symbol for something without
|
||||
// a postion because it would not show up on a map.
|
||||
// This just seems to be a remnant of something used long ago and no longer needed.
|
||||
// The protocol spec mentions a "MIM tracker" but I can't find any references to it.
|
||||
|
||||
// If this was completely removed, no one would probably ever notice.
|
||||
// The only possible useful case I can think of would be someone sending a
|
||||
// NMEA string directly from a GPS receiver and wanting to keep the destination field
|
||||
// for the system type.
|
||||
|
||||
if (dti == '$') {
|
||||
|
||||
p = strchr (src, '-');
|
||||
if (p != NULL) {
|
||||
int ssid = atoi(p+1);
|
||||
if (ssid >= 1 && ssid <= 15) {
|
||||
*symtab = '/'; /* All in Primary table. */
|
||||
*symbol = ssid_to_sym[ssid];
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -882,7 +882,7 @@ static void * tnc_thread_net (void *arg)
|
|||
// Expected message. Make sure it is expected sequence and send reply.
|
||||
int n = atoi(data);
|
||||
char reply[80];
|
||||
sprintf (reply, "%04d reply\r", n);
|
||||
snprintf (reply, sizeof(reply), "%04d reply\r", n);
|
||||
tnc_send_data (my_index, 1 - my_index, reply);
|
||||
|
||||
// HACK!
|
||||
|
@ -896,7 +896,7 @@ static void * tnc_thread_net (void *arg)
|
|||
if (n == 1 && max_count > 1) {
|
||||
int j;
|
||||
for (j = 1; j <= 26; j++) {
|
||||
sprintf (reply, "%.*s\r", j, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
snprintf (reply, sizeof(reply), "%.*s\r", j, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
tnc_send_data (my_index, 1 - my_index, reply);
|
||||
}
|
||||
}
|
||||
|
@ -992,7 +992,7 @@ static void * tnc_thread_serial (void *arg)
|
|||
|
||||
// do any necessary set up here. such as setting mycall
|
||||
|
||||
sprintf (cmd, "mycall %s\r", tnc_address[my_index]);
|
||||
snprintf (cmd, sizeof(cmd), "mycall %s\r", tnc_address[my_index]);
|
||||
serial_port_write (serial_fd[my_index], cmd, strlen(cmd));
|
||||
SLEEP_MS (200);
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ static void * tnc_thread_serial (void *arg)
|
|||
// Expected message. Make sure it is expected sequence and send reply.
|
||||
int n = atoi(result);
|
||||
char reply[80];
|
||||
sprintf (reply, "%04d reply\r", n);
|
||||
snprintf (reply, sizeof(reply), "%04d reply\r", n);
|
||||
tnc_send_data (my_index, 1 - my_index, reply);
|
||||
}
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ static void tnc_connect (int from, int to)
|
|||
SLEEP_MS (200);
|
||||
}
|
||||
|
||||
sprintf (cmd, "connect %s\r", tnc_address[to]);
|
||||
snprintf (cmd, sizeof(cmd), "connect %s\r", tnc_address[to]);
|
||||
serial_port_write (serial_fd[from], cmd, strlen(cmd));
|
||||
}
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ int tt_text_to_call10 (const char *text, int quiet, char *buttons)
|
|||
char padded[8];
|
||||
char stemp[11];
|
||||
|
||||
|
||||
// FIXME: Add parameter for sizeof buttons and use strlcpy
|
||||
strcpy (buttons, "");
|
||||
|
||||
/* Quick validity check. */
|
||||
|
@ -540,6 +540,7 @@ int tt_text_to_call10 (const char *text, int quiet, char *buttons)
|
|||
/* Binary to decimal for the columns. */
|
||||
|
||||
snprintf (stemp, sizeof(stemp), "%04d", packed);
|
||||
// FIXME: add parameter for sizeof buttons and use strlcat
|
||||
strcat (buttons, stemp);
|
||||
|
||||
return (errors);
|
||||
|
@ -1435,6 +1436,7 @@ int tt_satsq_to_text (const char *buttons, int quiet, char *text)
|
|||
row = buttons[0] - '0';
|
||||
col = buttons[1] - '0';
|
||||
|
||||
// FIXME: Add parameter for sizeof text and use strlcpy, strlcat.
|
||||
strcpy (text, grid[row][col]);
|
||||
strcat (text, buttons+2);
|
||||
|
||||
|
@ -1603,11 +1605,11 @@ int main (int argc, char *argv[])
|
|||
exit (1);
|
||||
}
|
||||
|
||||
strcpy (text, argv[1]);
|
||||
strlcpy (text, argv[1], sizeof(text));
|
||||
|
||||
for (n = 2; n < argc; n++) {
|
||||
strcat (text, " ");
|
||||
strcat (text, argv[n]);
|
||||
strlcat (text, " ", sizeof(text));
|
||||
strlcat (text, argv[n], sizeof(text));
|
||||
}
|
||||
|
||||
dw_printf ("Push buttons for multi-press method:\n");
|
||||
|
@ -1670,7 +1672,7 @@ int main (int argc, char *argv[])
|
|||
exit (1);
|
||||
}
|
||||
|
||||
strcpy (buttons, argv[1]);
|
||||
strlcpy (buttons, argv[1], sizeof(buttons));
|
||||
|
||||
for (n = 2; n < argc; n++) {
|
||||
strlcat (buttons, argv[n], sizeof(buttons));
|
||||
|
|
|
@ -187,7 +187,7 @@ int main (int argc, char *argv[])
|
|||
ax25_format_addrs (pp, result);
|
||||
info_len = ax25_get_info (pp, (unsigned char **)(&pinfo));
|
||||
pinfo[info_len] = '\0';
|
||||
strcat (result, pinfo);
|
||||
strlcat (result, pinfo, sizeof(result));
|
||||
for (p=result; *p!='\0'; p++) {
|
||||
if (! isprint(*p)) *p = ' ';
|
||||
}
|
||||
|
|
|
@ -187,10 +187,10 @@ void waypoint_init (struct misc_config_s *mc)
|
|||
|
||||
s_waypoint_formats = mc->waypoint_formats;
|
||||
if (s_waypoint_formats == 0) {
|
||||
s_waypoint_formats = WPT_FORMAT_NMEA_GENERIC | WPT_FORMAT_KENWOOD;
|
||||
s_waypoint_formats = WPL_FORMAT_NMEA_GENERIC | WPL_FORMAT_KENWOOD;
|
||||
}
|
||||
if (s_waypoint_formats & WPT_FORMAT_GARMIN) {
|
||||
s_waypoint_formats |= WPT_FORMAT_NMEA_GENERIC; /* See explanation below. */
|
||||
if (s_waypoint_formats & WPL_FORMAT_GARMIN) {
|
||||
s_waypoint_formats |= WPL_FORMAT_NMEA_GENERIC; /* See explanation below. */
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
|
@ -376,7 +376,7 @@ void waypoint_send_sentence (char *name_in, double dlat, double dlong, char symt
|
|||
* *99 is checksum
|
||||
*/
|
||||
|
||||
if (s_waypoint_formats & WPT_FORMAT_NMEA_GENERIC) {
|
||||
if (s_waypoint_formats & WPL_FORMAT_NMEA_GENERIC) {
|
||||
|
||||
snprintf (sentence, sizeof(sentence), "$GPWPL,%s,%s,%s,%s,%s", slat, slat_ns, slong, slong_ew, wname);
|
||||
append_checksum (sentence);
|
||||
|
@ -406,7 +406,7 @@ void waypoint_send_sentence (char *name_in, double dlat, double dlong, char symt
|
|||
* *99 is checksum
|
||||
*/
|
||||
|
||||
if (s_waypoint_formats & WPT_FORMAT_GARMIN) {
|
||||
if (s_waypoint_formats & WPL_FORMAT_GARMIN) {
|
||||
|
||||
int i = symbol - ' ';
|
||||
int grm_sym; /* Garmin symbol code. */
|
||||
|
@ -455,7 +455,7 @@ void waypoint_send_sentence (char *name_in, double dlat, double dlong, char symt
|
|||
* to delete that specific waypoint.
|
||||
*/
|
||||
|
||||
if (s_waypoint_formats & WPT_FORMAT_MAGELLAN) {
|
||||
if (s_waypoint_formats & WPL_FORMAT_MAGELLAN) {
|
||||
|
||||
int i = symbol - ' ';
|
||||
char sicon[3]; /* Magellan icon string. Currently 1 or 2 characters. */
|
||||
|
@ -567,7 +567,7 @@ void waypoint_send_sentence (char *name_in, double dlat, double dlong, char symt
|
|||
|
||||
|
||||
|
||||
if (s_waypoint_formats & WPT_FORMAT_KENWOOD) {
|
||||
if (s_waypoint_formats & WPL_FORMAT_KENWOOD) {
|
||||
|
||||
time_t now;
|
||||
struct tm tm;
|
||||
|
@ -654,7 +654,7 @@ void waypoint_send_ais (char *sentence)
|
|||
return;
|
||||
}
|
||||
|
||||
if (s_waypoint_formats & WPT_FORMAT_AIS) {
|
||||
if (s_waypoint_formats & WPL_FORMAT_AIS) {
|
||||
send_sentence (sentence);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue