FreeCalypso > hg > freecalypso-tools
view uptools/atcmd/atcmd.c @ 698:9ecbf1bf2e1b
fc-iram: added '+' to getopt magic string like in fc-xram
Both fc-iram and fc-xram now support secondary program invokation.
If the user needs to pass some options to the secondary program,
we don't want fc-iram or fc-xram to claim these options as its own,
thus we need to stop getopt() from reordering arguments. This fix
was already implemented in fc-xram a long time ago, but the issue
was overlooked when secondary program invokation ability was added
to fc-iram.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 31 Mar 2020 03:23:26 +0000 |
parents | dc2fd8e6f42c |
children |
line wrap: on
line source
/* * This utility allows a single AT command to be issued * through the atinterf framework. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "../../rvinterf/include/exitcodes.h" extern char at_response[]; int_callback() { puts(at_response+1); } main(argc, argv) char **argv; { int c; extern int optind; while ((c = getopt(argc, argv, "B:np:RX:")) != EOF) if (!atinterf_cmdline_opt(c)) { /* error msg already printed */ exit(ERROR_USAGE); } if (argc != optind + 1 || strncasecmp(argv[optind], "AT", 2)) { fprintf(stderr, "usage: %s [options] at-cmd\n", argv[0]); exit(ERROR_USAGE); } atinterf_init(); atinterf_exec_cmd(argv[optind], (char *) 0, int_callback); puts(at_response+1); exit(0); }