added ability to enter long command names in interactive mode, by prefixing them with a \

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1158 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.4
Stéphane Fillod, F8CFE 2002-09-06 10:43:59 +00:00
rodzic f78428fa09
commit c36db76150
2 zmienionych plików z 38 dodań i 8 usunięć

Wyświetl plik

@ -5,7 +5,7 @@
* It takes commands in interactive mode as well as
* from command line options.
*
* $Id: rigctl.c,v 1.35 2002-08-26 21:26:06 fillods Exp $
* $Id: rigctl.c,v 1.36 2002-09-06 10:43:59 fillods Exp $
*
*
* This program is free software; you can redistribute it and/or
@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <getopt.h>
@ -135,7 +136,7 @@ declare_proto_rig(get_info);
* TODO: add missing rig_set_/rig_get_: [rx]it, ant, sql, dcd, etc.
* NB: 'q' 'Q' '?' are reserved by interactive mode interface
*
* Available letters: -.--------K-----*-----W-YZ
* Available alphabetic letters: -.--------K-----*-----W-YZ
*/
struct test_table test_list[] = {
{ 'F', "set_freq", set_freq, ARG_IN, "Frequency" },
@ -453,6 +454,20 @@ int main (int argc, char *argv[])
do {
scanf("%c", &cmd);
/* command by name */
if (cmd == '\\') {
char cmd_name[MAXNAMSIZ], *pcmd = cmd_name;
int c_len = MAXNAMSIZ;
scanf("%c", pcmd);
while(c_len-- && (isalnum(*pcmd) || *pcmd == '_' ))
scanf("%c", ++pcmd);
*pcmd = '\0';
cmd = parse_arg(cmd_name);
break;
}
if (cmd == 0x0a || cmd == 0x0d) {
if (last_was_ret) {
printf("? for help, q to quit.\n");
@ -465,12 +480,12 @@ int main (int argc, char *argv[])
last_was_ret = 0;
/* comment line */
if (cmd == '#' || cmd == ';') {
while( cmd != '\n' && cmd != '\r')
scanf("%c", &cmd);
continue;
}
if (cmd == 'Q' || cmd == 'q')
break;
if (cmd == '?') {

Wyświetl plik

@ -1,11 +1,11 @@
/*
* rotctl.c - (C) Stephane Fillod 2000,2001
* rotctl.c - (C) Stephane Fillod 2000-2002
*
* This program test/control a rotator using Hamlib.
* It takes commands in interactive mode as well as
* from command line options.
*
* $Id: rotctl.c,v 1.3 2002-01-16 17:08:31 fgretief Exp $
* $Id: rotctl.c,v 1.4 2002-09-06 10:43:59 fillods Exp $
*
*
* This program is free software; you can redistribute it and/or
@ -32,6 +32,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <getopt.h>
@ -297,14 +298,28 @@ int main (int argc, char *argv[])
static int last_was_ret = 1;
if (interactive) {
printf("\nRig command: ");
printf("\nRot command: ");
do {
scanf("%c", &cmd);
/* command by name */
if (cmd == '\\') {
char cmd_name[MAXNAMSIZ], *pcmd = cmd_name;
int c_len = MAXNAMSIZ;
scanf("%c", pcmd);
while(c_len-- && (isalnum(*pcmd) || *pcmd == '_' ))
scanf("%c", ++pcmd);
*pcmd = '\0';
cmd = parse_arg(cmd_name);
break;
}
if (cmd == 0x0a || cmd == 0x0d) {
if (last_was_ret) {
printf("? for help, q to quit.\n");
printf("\nRig command: ");
printf("\nRot command: ");
continue;
}
last_was_ret = 1;
@ -489,7 +504,7 @@ void list_models()
rot_load_all_backends();
printf("Rig#\tMfg Model Vers.\n");
printf("Rot#\tMfg Model Vers.\n");
status = rot_list_foreach(print_model_list, NULL);
if (status != RIG_OK ) {
printf("rot_list_foreach: error = %s \n", rigerror(status));