set_trn/get_trn: more helpful/coherent args

* set_trn: Added help "?"
* get_trn: Returns OFF/RIG/POLL rather than 0/1/2, so that it matches

Author: Nirgal Vourgère <contact_hamlib@nirgal.com>
Hamlib-1.2.14
Stephane Fillod 2011-06-14 23:10:47 +02:00
rodzic bf1b3b982d
commit 0bfec55f10
1 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -1774,6 +1774,10 @@ declare_proto_rig(set_trn)
{
int trn;
if (!strcmp(arg1, "?")) {
fprintf(fout, "OFF RIG POLL\n");
return RIG_OK;
}
if (!strcmp(arg1, "OFF"))
trn = RIG_TRN_OFF;
else if (!strcmp(arg1, "RIG") || !strcmp(arg1, "ON"))
@ -1799,13 +1803,18 @@ declare_proto_rig(get_trn)
{
int status;
int trn;
static const char* trn_txt[] = {
"OFF",
"RIG",
"POLL"};
status = rig_get_trn(rig, &trn);
if (status != RIG_OK)
return status;
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
fprintf(fout, "%s: ", cmd->arg1);
fprintf(fout, "%d%c", trn, resp_sep);
if (trn>=0 && trn<=2)
fprintf(fout, "%s%c", trn_txt[trn], resp_sep);
return status;
}