MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / scanfc

Function scanfc

tests/rotctl_parse.c:393–427  ·  view source on GitHub ↗

* This scanf works even in presence of signals (timer, SIGIO, ..) */

Source from the content-addressed store, hash-verified

391 * This scanf works even in presence of signals (timer, SIGIO, ..)
392 */
393static int scanfc(FILE *fin, const char *format, void *p)
394{
395 do
396 {
397 int ret;
398
399 ret = fscanf(fin, format, p);
400
401 if (ret < 0)
402 {
403 if (errno == EINTR)
404 {
405 continue;
406 }
407
408 if (!feof(fin))
409 {
410 rig_debug(RIG_DEBUG_TRACE, "%s fscanf of:", __func__);
411 dump_hex((unsigned char *)p, strlen(p));
412 rig_debug(RIG_DEBUG_TRACE, " failed with format '%s'\n", format);
413 }
414
415 }
416
417 if (ferror(fin)) { rig_debug(RIG_DEBUG_ERR, "%s: errno=%d, %s\n", __func__, errno, strerror(errno)); clearerr(fin); }
418
419 if (errno == EINVAL) // invalid arg we will continue
420 {
421 continue;
422 }
423
424 return ret;
425 }
426 while (1);
427}
428
429
430/*

Callers 1

rotctl_parseFunction · 0.70

Calls 2

rig_debugFunction · 0.85
dump_hexFunction · 0.85

Tested by

no test coverage detected