mirror of https://github.com/wb2osz/direwolf.git
Fix MIC-E comment when device id is missing.
This commit is contained in:
parent
89029db610
commit
0d7e296d6d
|
@ -568,16 +568,18 @@ void deviceid_decode_dest (char *dest, char *device, size_t device_size)
|
||||||
*
|
*
|
||||||
* Inputs: comment - MIC-E comment that might have vendor/model encoded as
|
* Inputs: comment - MIC-E comment that might have vendor/model encoded as
|
||||||
* a prefix and/or suffix.
|
* a prefix and/or suffix.
|
||||||
|
* Any trailing CR has already been removed.
|
||||||
*
|
*
|
||||||
* trimmed_size - Amount of space available for result to avoid buffer overflow.
|
* trimmed_size - Amount of space available for result to avoid buffer overflow.
|
||||||
*
|
*
|
||||||
* device_size - Amount of space available for result to avoid buffer overflow.
|
* device_size - Amount of space available for result to avoid buffer overflow.
|
||||||
*
|
*
|
||||||
* Outputs: trimmed - Final comment with device vendor/model removed.
|
* Outputs: trimmed - Final comment with device vendor/model removed.
|
||||||
|
* This would include any altitude.
|
||||||
*
|
*
|
||||||
* device - Vendor and model.
|
* device - Vendor and model.
|
||||||
*
|
*
|
||||||
* Description: This has a tortured history.
|
* Description: MIC-E device identification has a tortured history.
|
||||||
*
|
*
|
||||||
* The Kenwood TH-D7A put ">" at the beginning of the comment.
|
* The Kenwood TH-D7A put ">" at the beginning of the comment.
|
||||||
* The Kenwood TM-D700 put "]" at the beginning of the comment.
|
* The Kenwood TM-D700 put "]" at the beginning of the comment.
|
||||||
|
@ -593,7 +595,9 @@ void deviceid_decode_dest (char *dest, char *device, size_t device_size)
|
||||||
*
|
*
|
||||||
* References: http://www.aprs.org/aprs12/mic-e-types.txt
|
* References: http://www.aprs.org/aprs12/mic-e-types.txt
|
||||||
* http://www.aprs.org/aprs12/mic-e-examples.txt
|
* http://www.aprs.org/aprs12/mic-e-examples.txt
|
||||||
*
|
* https://github.com/wb2osz/aprsspec containing:
|
||||||
|
* APRS Protocol Specification 1.2
|
||||||
|
* Understanding APRS Packets
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
// The strncmp documentation doesn't mention behavior if length is zero.
|
// The strncmp documentation doesn't mention behavior if length is zero.
|
||||||
|
@ -612,6 +616,10 @@ static inline int strncmp_z (char *a, char *b, size_t len)
|
||||||
void deviceid_decode_mice (char *comment, char *trimmed, size_t trimmed_size, char *device, size_t device_size)
|
void deviceid_decode_mice (char *comment, char *trimmed, size_t trimmed_size, char *device, size_t device_size)
|
||||||
{
|
{
|
||||||
strlcpy (device, "UNKNOWN vendor/model", device_size);
|
strlcpy (device, "UNKNOWN vendor/model", device_size);
|
||||||
|
strlcpy (trimmed, comment, sizeof(trimmed));
|
||||||
|
if (strlen(comment) < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ptocalls == NULL) {
|
if (ptocalls == NULL) {
|
||||||
text_color_set(DW_COLOR_ERROR);
|
text_color_set(DW_COLOR_ERROR);
|
||||||
|
@ -663,6 +671,7 @@ void deviceid_decode_mice (char *comment, char *trimmed, size_t trimmed_size, ch
|
||||||
// Not found.
|
// Not found.
|
||||||
|
|
||||||
strlcpy (device, "UNKNOWN vendor/model", device_size);
|
strlcpy (device, "UNKNOWN vendor/model", device_size);
|
||||||
|
strlcpy (trimmed, comment, sizeof(trimmed));
|
||||||
|
|
||||||
} // end deviceid_decode_mice
|
} // end deviceid_decode_mice
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue