| 464 | |
| 465 | |
| 466 | int 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 != '#' |
no test coverage detected