changeset 447:e13f60d4f8dd

fc-shell: added unterm command for sending unterminated strings to ATI
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 09 Jan 2019 07:58:06 +0000
parents a449ae0a1cec
children 261c1b6d936e
files rvinterf/asyncshell/at.c rvinterf/asyncshell/usercmd.c
diffstat 2 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/asyncshell/at.c	Sat Dec 29 06:59:27 2018 +0000
+++ b/rvinterf/asyncshell/at.c	Wed Jan 09 07:58:06 2019 +0000
@@ -39,6 +39,26 @@
 	return(0);
 }
 
+send_unterm_string_to_ati(str)
+	char *str;
+{
+	unsigned len;
+	u_char sendpkt[MAX_PKT_TO_TARGET+1];
+
+	len = strlen(str);
+	if (len + 2 > MAX_PKT_TO_TARGET) {
+		printf("error: max pkt to target limit exceeded\n");
+		return(ERROR_USAGE);
+	}
+	/* fill out the packet */
+	sendpkt[0] = RVT_AT_HEADER;
+	sendpkt[1] = 0x01;
+	strcpy(sendpkt + 2, str);
+	/* send it! */
+	send_pkt_to_target(sendpkt, len + 2);
+	return(0);
+}
+
 void
 cmd_sendat(arg)
 	char *arg;
@@ -53,6 +73,20 @@
 	send_string_to_ati(arg);
 }
 
+void
+cmd_unterm(arg)
+	char *arg;
+{
+	while (isspace(*arg))
+		arg++;
+	if (!*arg) {
+		printf("error: missing string argument\n");
+		return;
+	}
+	ati_rx_control(1);
+	send_unterm_string_to_ati(arg);
+}
+
 oneshot_at_command(cmd)
 	char *cmd;
 {
--- a/rvinterf/asyncshell/usercmd.c	Sat Dec 29 06:59:27 2018 +0000
+++ b/rvinterf/asyncshell/usercmd.c	Wed Jan 09 07:58:06 2019 +0000
@@ -24,6 +24,7 @@
 extern void cmd_tch_dispatch();
 extern void cmd_tchdl_interactive();
 extern void cmd_tgtreset();
+extern void cmd_unterm();
 
 void
 cmd_exit()
@@ -51,6 +52,7 @@
 	{"tch", cmd_tch_dispatch},
 	{"tch-dl", cmd_tchdl_interactive},
 	{"tgtreset", cmd_tgtreset},
+	{"unterm", cmd_unterm},
 	{0, 0}
 };