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

Function ampctl_parse

tests/ampctl_parse.c:466–1435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464
465
466int ampctl_parse(AMP *my_amp, FILE *fin, FILE *fout, char *argv[], int argc)
467{
468 int retcode; /* generic return code from functions */
469 unsigned char cmd;
470 struct test_table *cmd_entry;
471
472 char command[MAXARGSZ + 1];
473 char arg1[MAXARGSZ + 1], *p1 = NULL;
474 char arg2[MAXARGSZ + 1], *p2 = NULL;
475 char arg3[MAXARGSZ + 1], *p3 = NULL;
476 char arg4[MAXARGSZ + 1], *p4 = NULL;
477#ifdef __USEP5P6__ // to avoid cppcheck warning
478 char *p5 = NULL;
479 char *p6 = NULL;
480#endif
481 char arg_format[8];
482
483 SNPRINTF(arg_format, sizeof(arg_format), "%%%ds", MAXARGSZ);
484
485 /* cmd, internal, ampctld */
486 if (!(interactive && prompt && have_rl))
487 {
488 if (interactive)
489 {
490 static int last_was_ret = 1;
491
492 if (prompt)
493 {
494 fprintf_flush(fout, "\nAmplifier command: ");
495 }
496
497 do
498 {
499 if (scanfc(fin, "%c", &cmd) < 1)
500 {
501 return -1;
502 }
503
504 /* Extended response protocol requested with leading '+' on command
505 * string--ampctld only!
506 */
507 if (cmd == '+' && !prompt)
508 {
509 ext_resp = 1;
510
511 if (scanfc(fin, "%c", &cmd) < 1)
512 {
513 return -1;
514 }
515 }
516 else if (cmd == '+' && prompt)
517 {
518 return 0;
519 }
520
521 if (cmd != '\\'
522 && cmd != '_'
523 && cmd != '#'

Callers 2

handle_socketFunction · 0.85
mainFunction · 0.85

Calls 10

usage_ampFunction · 0.85
rig_debugFunction · 0.85
pthread_mutex_lockFunction · 0.85
pthread_mutex_unlockFunction · 0.85
rigerrorFunction · 0.85
scanfcFunction · 0.70
parse_argFunction · 0.70
next_wordFunction · 0.70
find_cmd_entryFunction · 0.70
rp_getlineFunction · 0.70

Tested by

no test coverage detected