1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-04-21 12:27:27 +03:00

tools/: added option -d driver[:arg] to all tools

- atrf-id/atrf-id.c (main), atrf-reset/atrf-reset.c (main),
  atrf-trim/atrf-trim.c (main): changed command-line parsing to use
  "getopt"
- atrf-id/atrf-id.c (usage, main), atrf-reset/atrf-reset.c (usage, main),
  atrf-rssi/atrf-rssi.c (usage, main), atrf-trim/atrf-trim.c (usage,
  main), atrf-txrx/atrf-txrx.c (init_txrx, usage, main),
  atrf-xtal/atrf-xtal.c (usage, main): added option -d to select a driver
This commit is contained in:
Werner Almesberger
2011-04-10 07:13:53 -03:00
parent 1175923df7
commit 7ff1a32ccf
6 changed files with 96 additions and 47 deletions

View File

@@ -64,11 +64,11 @@ static void die(int sig)
static void usage(const char *name)
{
fprintf(stderr,
"usage: %s [-n] sweeps\n", name);
"usage: %s [-d driver[:arg]] [-n] sweeps\n", name);
#ifdef HAVE_GFX
fprintf(stderr,
"%6s %s -g\n", "", name);
"%6s %s driver[:arg]] -g\n", "", name);
#endif
exit(1);
@@ -77,14 +77,18 @@ static void usage(const char *name)
int main(int argc, char **argv)
{
const char *driver = NULL;
struct atrf_dsc *dsc;
unsigned long arg = 0, i;
char *end;
int c;
int graphical = 0;
while ((c = getopt(argc, argv, "gn")) != EOF)
while ((c = getopt(argc, argv, "d:gn")) != EOF)
switch (c) {
case 'd':
driver = optarg;
break;
#ifdef HAVE_GFX
case 'g':
graphical = 1;
@@ -115,7 +119,7 @@ int main(int argc, char **argv)
signal(SIGINT, die);
dsc = atrf_open(NULL);
dsc = atrf_open(driver);
if (!dsc)
return 1;