comparison rvinterf/asyncshell/sendarb.c @ 1012:93f4fc26b204

fc-shell: arbitrary send command implemented in one-shot mode
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Sun, 20 Mar 2016 22:06:11 +0000
parents
children 6eee1e547778
comparison
equal deleted inserted replaced
1011:820d34f3f3d7 1012:93f4fc26b204
1 /*
2 * Command for sending arbitrary packets to the target
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include <ctype.h>
8 #include <string.h>
9 #include <strings.h>
10 #include <stdlib.h>
11 #include "limits.h"
12
13 cmd_send_oneshot(argc, argv)
14 char **argv;
15 {
16 u_char sendpkt[MAX_PKT_TO_TARGET];
17 unsigned pktlen = argc - 1, i;
18 char *endp;
19
20 for (i = 0; i < pktlen; i++) {
21 sendpkt[i] = strtoul(argv[i+1], &endp, 16);
22 if (*endp) {
23 printf(
24 "error: all arguments to send command must be hex bytes\n");
25 return(1);
26 }
27 }
28 /* send it! */
29 send_pkt_to_target(sendpkt, pktlen);
30 return(0);
31 }