Fix decimal separators which sscanf can't handle

This is a workaround for some apps like Gpredict, which use comma as a decimal
separator (depending on locale settings), but sscanf in Hamlib can only handle
dots.

(cherry picked from commit 2deeca86dc)
Hamlib-4.0
Nonoo 2020-11-14 08:56:37 +01:00 zatwierdzone przez Nate Bargmann
rodzic c76bf379e7
commit cfba9f18cf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F72625E2EDBED598
1 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -1692,6 +1692,22 @@ declare_proto_rot(set_position)
{
azimuth_t az;
elevation_t el;
char *comma_pos;
/* Fixing args with an invalid decimal separator. */
comma_pos = strchr(arg1, ',');
if (comma_pos)
{
*comma_pos = '.';
}
comma_pos = strchr(arg2, ',');
if (comma_pos)
{
*comma_pos = '.';
}
CHKSCN1ARG(sscanf(arg1, "%f", &az));
CHKSCN1ARG(sscanf(arg2, "%f", &el));