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

Function main

tests/rigctl.c:202–876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202int main(int argc, char *argv[])
203{
204 rig_model_t my_model = RIG_MODEL_DUMMY;
205
206 int retcode; /* generic return code from functions */
207 int exitcode;
208
209 int verbose = RIG_DEBUG_NONE;
210 int show_conf = 0;
211 int dump_caps_opt = 0;
212 int ignore_rig_open_error = 0;
213
214#ifdef HAVE_READLINE_HISTORY
215 int rd_hist = 0;
216 int sv_hist = 0;
217 const char *hist_dir = NULL;
218 const char hist_file[] = "/.rigctl_history";
219 char *hist_path = NULL;
220#endif /* HAVE_READLINE_HISTORY */
221
222 const char *rig_file = NULL, *ptt_file = NULL, *dcd_file = NULL;
223 ptt_type_t ptt_type = RIG_PTT_NONE;
224 dcd_type_t dcd_type = RIG_DCD_NONE;
225 int serial_rate = 0;
226 const char *civaddr = NULL; /* NULL means no need to set conf */
227 char conf_parms[MAXCONFLEN] = "";
228 int interactive; /* if no cmd on command line, switch to interactive */
229 int prompt = 1; /* Print prompt in rigctl */
230 int vfo_opt = 0; /* vfo_opt = 0 means target VFO is 'currVFO' */
231 char send_cmd_term = '\r'; /* send_cmd termination char */
232 int ext_resp = 0;
233 int i;
234 char rigstartup[1024];
235 char vbuf[1024];
236 rig_powerstat = RIG_POWER_ON; // defaults to power on
237 struct timespec powerstat_check_time;
238#if HAVE_SIGACTION
239 struct sigaction act;
240#endif
241
242 int err = setvbuf(stderr, vbuf, _IOFBF, sizeof(vbuf));
243
244 if (err) { rig_debug(RIG_DEBUG_ERR, "%s: setvbuf err=%s\n", __func__, strerror(err)); }
245
246 rig_set_debug(verbose);
247 while (1)
248 {
249 int c;
250 int option_index = 0;
251 char dummy[2];
252
253 c = getopt_long(argc,
254 argv,
255 SHORT_OPTIONS HST_SHRT_OPTS,
256 long_options,
257 &option_index);
258
259 if (c == -1)

Callers

nothing calls this directly

Calls 15

rig_debugFunction · 0.85
rig_set_debugFunction · 0.85
getopt_longFunction · 0.85
rig_no_restore_aiFunction · 0.85
rig_set_debug_time_stampFunction · 0.85
rig_token_lookupFunction · 0.85
rig_set_confFunction · 0.85
rigerrorFunction · 0.85
dumpconfFunction · 0.85
rig_openFunction · 0.85
rig_closeFunction · 0.85
dumpstateFunction · 0.85

Tested by

no test coverage detected