Skip to content

Commit 923a789

Browse files
committed
Fix sscanf() truncating input from thousands separator
Per Github issue Hamlib#1704, N3FJP logger sends a string with an embedded comma for frequencies above 1 GHz resulting in such frequencies being truncated. This patch uses the optional apostrophe character in the sscanf() format string to ignore the thousands separator. A possible bug is when the locale of the system on which libhamlib is executing uses a dot for the thousands separator rather than a comma. It is unclear if the N3FJP software obeys such locales or not. If this turns out to be an issue then this fix will need to be reconsidered.
1 parent 9aed263 commit 923a789

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rigs/dummy/aclog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static int aclog_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
461461
char *p = strstr(value, "<FREQ>");
462462
*freq = 0;
463463

464-
if (p) { sscanf(p, "<FREQ>%lf", freq); }
464+
if (p) { sscanf(p, "<FREQ>%'lf", freq); }
465465

466466
*freq *= 1e6; // convert from MHz to Hz
467467

0 commit comments

Comments
 (0)