FreeCalypso > hg > freecalypso-tools
comparison uptools/atcmd/atcmd.c @ 348:64dcbabd48ca
uptools/atcmd framework started
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 04 Feb 2018 18:38:20 +0000 |
parents | |
children | dc2fd8e6f42c |
comparison
equal
deleted
inserted
replaced
347:dd5bab5156bf | 348:64dcbabd48ca |
---|---|
1 /* | |
2 * This utility allows a single AT command to be issued | |
3 * through the atinterf framework. | |
4 */ | |
5 | |
6 #include <stdio.h> | |
7 #include <stdlib.h> | |
8 #include <unistd.h> | |
9 #include "../../rvinterf/include/exitcodes.h" | |
10 | |
11 extern char at_response[]; | |
12 | |
13 int_callback() | |
14 { | |
15 puts(at_response+1); | |
16 } | |
17 | |
18 main(argc, argv) | |
19 char **argv; | |
20 { | |
21 int c; | |
22 extern int optind; | |
23 | |
24 while ((c = getopt(argc, argv, "B:np:RX:")) != EOF) | |
25 if (!atinterf_cmdline_opt(c)) { | |
26 /* error msg already printed */ | |
27 exit(ERROR_USAGE); | |
28 } | |
29 if (argc != optind + 1 || strncasecmp(argv[optind], "AT", 2)) { | |
30 fprintf(stderr, "usage: %s [options] at-cmd\n", argv[0]); | |
31 exit(ERROR_USAGE); | |
32 } | |
33 atinterf_init(); | |
34 atinterf_exec_cmd(argv[optind], 0, int_callback); | |
35 puts(at_response+1); | |
36 exit(0); | |
37 } |