Allow rigctl w command to quote arg1 for use by SmartSDR

e.g. w "C0|set slice 0 tx=1"
pull/1557/head
Mike Black W9MDB 2024-05-22 11:44:54 -05:00
rodzic b7adb19c7e
commit c73c728b5e
2 zmienionych plików z 16 dodań i 1 usunięć

Wyświetl plik

@ -1273,7 +1273,8 @@ For binary protocols enter values as \\0xAA\\0xBB. Expect a
.RI \(aq Reply \(aq
from the radio which will likely be a binary block or an ASCII string
depending on the radio's protocol (see your radio's computer control
documentation).
documentation). If you are testing a protocol like SmartSDR where there
are spaces in the commands use quote, e.g. w "C0|set slice 0 tx=1"
.IP
The command terminator, set by the
.B send-cmd-term

Wyświetl plik

@ -495,6 +495,19 @@ void hash_delete_all()
}
}
// modifies s to remove quotes
void strip_quotes(char *s)
{
char *s2 = strdup(s);
char *p;
if (s[0] != '\"') return; // no quotes
s2 = strdup(&s[1]);
p = strrchr(s2,'"');
if (p) *p = 0;
strcpy(s,s2);
}
#ifdef HAVE_LIBREADLINE
/* Frees allocated memory and sets pointers to NULL before calling readline
* and then parses the input into space separated tokens.
@ -1726,6 +1739,7 @@ readline_repeat:
* Extended Response protocol: output received command name and arguments
* response. Don't send command header on '\chk_vfo' command.
*/
if (p1) strip_quotes(p1);
if (interactive && *ext_resp_ptr && !prompt && cmd != 0xf0)
{
char a1[MAXARGSZ + 2];