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

Function scanfc

tests/rigctl_parse.c:565–600  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

563 * This scanf works even in presence of signals (timer, SIGIO, ..)
564 */
565static int scanfc(FILE *fin, const char *format, void *p)
566{
567 do
568 {
569 int ret;
570 *(char *)p = 0;
571
572
573 ret = fscanf(fin, format, p);
574
575 if (ret < 0)
576 {
577 if (errno == EINTR)
578 {
579 continue;
580 }
581
582 if (!feof(fin))
583 {
584 rig_debug(RIG_DEBUG_TRACE, "%s fscanf of:", __func__);
585 dump_hex((unsigned char *)p, strlen(p));
586 rig_debug(RIG_DEBUG_TRACE, " failed with format '%s'\n", format);
587 ret = 0x0a;
588 }
589 }
590
591 if (ret < 1) { rig_debug(RIG_DEBUG_TRACE, "%s: ret=%d\n", __func__, ret); }
592
593 if (errno == 22) { return -22; }
594
595 if (ferror(fin)) { rig_debug(RIG_DEBUG_ERR, "%s: errno=%d, %s\n", __func__, errno, strerror(errno)); }
596
597 return ret;
598 }
599 while (1);
600}
601
602
603/*

Callers 2

rigctl_parseFunction · 0.70
rigctl_parse.cFile · 0.70

Calls 2

rig_debugFunction · 0.85
dump_hexFunction · 0.85

Tested by

no test coverage detected