annotate rvinterf/rvtat/main.c @ 983:0407d14fb854

PL-J flash PPB ops: rework for full verification of lock state
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 02 Dec 2023 08:22:00 +0000
parents 261c1b6d936e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <sys/types.h>
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <stdio.h>
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <stdlib.h>
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 #include <string.h>
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <strings.h>
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <unistd.h>
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
7 #include "pktmux.h"
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
8 #include "limits.h"
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
9 #include "localtypes.h"
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
10 #include "exitcodes.h"
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
12 extern char *socket_pathname;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
13 extern char *rvinterf_ttyport, *rvinterf_Bopt, *rvinterf_lopt, *rvinterf_wopt;
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
15 extern u_char rvi_msg[];
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
16 extern int rvi_msg_len;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
17
448
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
18 char command[508], message[508];
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 int cmd_with_msg;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 read_command_input(buf)
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 char *buf;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 char *nl;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
448
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
26 if (!fgets(buf, 508, stdin))
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 return(0);
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 nl = index(buf, '\n');
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 if (!nl) {
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 printf("Ecommand or message is too long\n");
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 exit(1);
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 *nl = '\0';
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 return(1);
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
448
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
37 send_to_target_prefix(str)
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
38 char *str;
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
39 {
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
40 u_char sendpkt[MAX_PKT_TO_TARGET];
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
41
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
42 /* fill out the packet */
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
43 sendpkt[0] = RVT_AT_HEADER;
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
44 sendpkt[1] = 0x01;
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
45 bcopy(str, sendpkt + 2, 252);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
46 /* send it! */
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
47 send_pkt_to_target(sendpkt, 254);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
48 return(0);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
49 }
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
50
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
51 send_to_target_plain(str)
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
52 char *str;
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 {
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
54 unsigned len;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
55 u_char sendpkt[MAX_PKT_TO_TARGET+1];
345
cc207d81c05f fcup-atinterf: implemented wakeup of sleeping targets
Mychaela Falconia <falcon@freecalypso.org>
parents: 344
diff changeset
56
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
57 len = strlen(str);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
58 /* fill out the packet */
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
59 sendpkt[0] = RVT_AT_HEADER;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
60 strcpy(sendpkt + 1, str);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
61 /* send it! */
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
62 send_pkt_to_target(sendpkt, len + 1);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
63 return(0);
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
448
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
66 send_to_target(str)
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
67 char *str;
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
68 {
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
69 unsigned len;
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
70
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
71 len = strlen(str);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
72 if (len <= 254)
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
73 send_to_target_plain(str);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
74 else {
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
75 send_to_target_prefix(str);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
76 send_to_target_plain(str + 252);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
77 }
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
78 return(0);
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
79 }
261c1b6d936e fcup-rvtat: added support for long strings with new fw versions
Mychaela Falconia <falcon@freecalypso.org>
parents: 423
diff changeset
80
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 execute_command()
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 {
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
83 send_to_target(command);
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 if (cmd_with_msg) {
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
85 collect_pkt_from_target();
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
86 if (rvi_msg_len != 4 || rvi_msg[2] != '>' || rvi_msg[3] != ' '){
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
87 printf("F%.*s\n", rvi_msg_len - 2, rvi_msg + 2);
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 return;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 }
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
90 send_to_target(message);
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 for (;;) {
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
93 collect_pkt_from_target();
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
94 if (rvi_msg_len == 4 && !strncmp(rvi_msg + 2, "OK", 2) ||
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
95 rvi_msg_len == 7 && !strncmp(rvi_msg + 2, "ERROR", 5) ||
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
96 rvi_msg_len == 6 && !strncmp(rvi_msg + 2, "BUSY", 4) ||
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
97 rvi_msg_len == 12 &&
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
98 !strncmp(rvi_msg + 2, "NO CARRIER", 10) ||
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
99 rvi_msg_len >= 12 &&
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
100 !strncmp(rvi_msg + 2, "+CME ERROR", 10) ||
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
101 rvi_msg_len >= 12 &&
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
102 !strncmp(rvi_msg + 2, "+CMS ERROR", 10)) {
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
103 printf("F%.*s\n", rvi_msg_len - 2, rvi_msg + 2);
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 return;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 }
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
106 printf("I%.*s\n", rvi_msg_len - 2, rvi_msg + 2);
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 main(argc, argv)
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 char **argv;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 {
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
113 extern int optind;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
114 extern char *optarg;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
115 int c, sopt = 0;
345
cc207d81c05f fcup-atinterf: implemented wakeup of sleeping targets
Mychaela Falconia <falcon@freecalypso.org>
parents: 344
diff changeset
116
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
117 while ((c = getopt(argc, argv, "B:l:p:s:w:")) != EOF)
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
118 switch (c) {
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
119 case 'B':
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
120 rvinterf_Bopt = optarg;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
121 continue;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
122 case 'l':
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
123 rvinterf_lopt = optarg;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
124 continue;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
125 case 'p':
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
126 rvinterf_ttyport = optarg;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
127 continue;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
128 case 's':
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
129 socket_pathname = optarg;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
130 sopt++;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
131 continue;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
132 case 'w':
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
133 rvinterf_wopt = optarg;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
134 continue;
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
135 case '?':
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
136 default:
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
137 /* error msg already printed */
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
138 exit(ERROR_USAGE);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
139 }
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
140 if (rvinterf_ttyport) {
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
141 if (sopt) {
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
142 fprintf(stderr,
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
143 "%s error: -p and -s options are mutually exclusive\n",
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
144 argv[0]);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
145 exit(ERROR_USAGE);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
146 }
423
e40bb5a6c6b9 rvinterf clients: implemented 30 ms delay for batch ops with -p
Mychaela Falconia <falcon@freecalypso.org>
parents: 346
diff changeset
147 launch_rvinterf(1);
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
148 } else {
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
149 if (rvinterf_Bopt || rvinterf_lopt || rvinterf_wopt) {
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
150 fprintf(stderr,
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
151 "%s error: -B, -l and -w options are meaningful only when launching rvinterf\n",
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
152 argv[0]);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
153 exit(ERROR_USAGE);
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
154 }
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
155 connect_local_socket();
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 while (read_command_input(command)) {
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 if (!strcasecmp(command, "c+m")) {
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 cmd_with_msg = 1;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 if (!read_command_input(command))
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 break;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 if (!read_command_input(message))
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 break;
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 } else
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166 cmd_with_msg = 0;
346
99471c57155a fcup-rvtat program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents: 345
diff changeset
167 rx_control(1);
341
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 execute_command();
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 fflush(stdout);
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 }
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171 exit(0);
692dbc4c2f07 fcup-atinterf program written, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 }