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

Function rigctl_parse

tests/rigctl_parse.c:716–1954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714}
715
716int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
717 sync_cb_t sync_cb,
718 int interactive, int prompt, int *vfo_opt, char send_cmd_term,
719 int *ext_resp_ptr, char *resp_sep_ptr, int use_password)
720{
721 int retcode = -RIG_EINTERNAL; /* generic return code from functions */
722 unsigned char cmd;
723 struct test_table *cmd_entry = NULL;
724 struct rig_state *rs = STATE(my_rig);
725 struct handle_data *connection;
726
727 char command[MAXARGSZ + 1] = "";
728 char arg1[MAXARGSZ + 1], *p1 = NULL;
729 char arg2[MAXARGSZ + 1], *p2 = NULL;
730 char arg3[MAXARGSZ + 1], *p3 = NULL;
731 vfo_t vfo = RIG_VFO_CURR;
732 char client_version[32];
733 char name_format[8];
734 char arg_format[8];
735
736 rig_debug(RIG_DEBUG_TRACE, "%s: called, interactive=%d\n", __func__,
737 interactive);
738
739 SNPRINTF(name_format, sizeof(name_format), "%%%ds", MAXNAMSIZ - 1);
740 SNPRINTF(arg_format, sizeof(arg_format), "%%%ds", MAXARGSZ - 1);
741
742 /* cmd, internal, rigctld */
743 if (!(interactive && prompt && have_rl))
744 {
745
746 if (interactive)
747 {
748 static int last_was_ret = 1;
749 static int last_cmd;
750
751 if (prompt)
752 {
753 fprintf_flush(fout, "\nRig command: ");
754 }
755
756 do
757 {
758 if ((retcode = scanfc(fin, "%c", &cmd)) < 1)
759 {
760 if (last_cmd == 0)
761 {
762 rig_debug(RIG_DEBUG_WARN,
763 "%s: nothing to scan#1? retcode=%d, last_cmd=[empty]\n",
764 __func__,
765 retcode);
766 }
767 else
768 {
769 rig_debug(RIG_DEBUG_WARN, "%s: nothing to scan#1? retcode=%d, last_cmd=%c\n",
770 __func__,
771 retcode, last_cmd);
772 }
773

Callers 3

handle_socketFunction · 0.85
handle_socketFunction · 0.85
mainFunction · 0.85

Calls 13

rig_debugFunction · 0.85
usage_rigFunction · 0.85
rig_parse_vfoFunction · 0.85
rig_strvfoFunction · 0.85
strip_quotesFunction · 0.85
rig_openFunction · 0.85
pthread_getspecificFunction · 0.85
rigerrorFunction · 0.85
scanfcFunction · 0.70
parse_argFunction · 0.70
next_wordFunction · 0.70
find_cmd_entryFunction · 0.70

Tested by

no test coverage detected