FreeCalypso > hg > freecalypso-tools
comparison rvinterf/asyncshell/main.c @ 75:bbc41034f14c
fc-shell: added support for AT commands in one-shot mode
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 27 Oct 2016 02:13:38 +0000 |
parents | 84920d3d97c6 |
children | c1aadfcd185f |
comparison
equal
deleted
inserted
replaced
74:84920d3d97c6 | 75:bbc41034f14c |
---|---|
10 #include "exitcodes.h" | 10 #include "exitcodes.h" |
11 | 11 |
12 char *socket_pathname = "/tmp/rvinterf_socket"; | 12 char *socket_pathname = "/tmp/rvinterf_socket"; |
13 char *rvinterf_ttyport; | 13 char *rvinterf_ttyport; |
14 int ttyhacks, dflag; | 14 int ttyhacks, dflag; |
15 int oneshot_mode, oneshot_nowait; | |
15 | 16 |
16 int sock; | 17 int sock; |
17 | 18 |
18 extern char *rvinterf_Bopt, *rvinterf_lopt, *rvinterf_wopt; | 19 extern char *rvinterf_Bopt, *rvinterf_lopt, *rvinterf_wopt; |
19 | 20 |
23 extern int optind; | 24 extern int optind; |
24 extern char *optarg; | 25 extern char *optarg; |
25 int c, sopt = 0; | 26 int c, sopt = 0; |
26 fd_set fds; | 27 fd_set fds; |
27 | 28 |
28 while ((c = getopt(argc, argv, "B:dl:p:s:w:")) != EOF) | 29 while ((c = getopt(argc, argv, "B:dl:np:s:w:")) != EOF) |
29 switch (c) { | 30 switch (c) { |
30 case 'B': | 31 case 'B': |
31 rvinterf_Bopt = optarg; | 32 rvinterf_Bopt = optarg; |
32 continue; | 33 continue; |
33 case 'd': | 34 case 'd': |
34 dflag++; | 35 dflag++; |
35 continue; | 36 continue; |
36 case 'l': | 37 case 'l': |
37 rvinterf_lopt = optarg; | 38 rvinterf_lopt = optarg; |
39 continue; | |
40 case 'n': | |
41 oneshot_nowait++; | |
38 continue; | 42 continue; |
39 case 'p': | 43 case 'p': |
40 rvinterf_ttyport = optarg; | 44 rvinterf_ttyport = optarg; |
41 continue; | 45 continue; |
42 case 's': | 46 case 's': |
67 exit(ERROR_USAGE); | 71 exit(ERROR_USAGE); |
68 } | 72 } |
69 connect_local_socket(); | 73 connect_local_socket(); |
70 } | 74 } |
71 | 75 |
72 if (argv[optind]) | 76 if (argv[optind]) { |
77 oneshot_mode = 1; | |
73 return oneshot_command(argc - optind, argv + optind); | 78 return oneshot_command(argc - optind, argv + optind); |
79 } | |
74 | 80 |
75 ttyhacks = isatty(0) && !dflag; | 81 ttyhacks = isatty(0) && !dflag; |
76 init(); | 82 init(); |
77 tty_init(); | 83 tty_init(); |
78 for (;;) { | 84 for (;;) { |