i2c_spi_buses:Track NuttX change to getopts avoid name collision

NuttX #defined optarg and getopt to move to TLS. This fixes the
  name collision.
This commit is contained in:
David Sidrane
2021-04-20 10:47:11 -07:00
committed by Julian Oes
parent 64db89ab20
commit 84dd8839a2
55 changed files with 245 additions and 214 deletions
+6 -6
View File
@@ -196,17 +196,17 @@ bool I2CSPICLITest::test_custom()
int T = 0;
int a = 0;
while ((ch = cli.getopt(cli_args.argc, cli_args.argv, "T:a:")) != EOF) {
while ((ch = cli.getOpt(cli_args.argc, cli_args.argv, "T:a:")) != EOF) {
switch (ch) {
case 'T': T = atoi(cli.optarg());
case 'T': T = atoi(cli.optArg());
break;
case 'a': a = atoi(cli.optarg());
case 'a': a = atoi(cli.optArg());
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
ut_assert_true(verb != nullptr);
ut_assert_true(strcmp(verb, "start") == 0);
ut_assert_true(T == 432);
@@ -222,14 +222,14 @@ bool I2CSPICLITest::test_custom()
CLIArgsHelper cli_args(argv, 1);
int ch;
while ((ch = cli.getopt(cli_args.argc, cli_args.argv, "I:")) != EOF) {
while ((ch = cli.getOpt(cli_args.argc, cli_args.argv, "I:")) != EOF) {
switch (ch) {
case 'I': ut_assert_true(false); // must not get here, because 'I' is already used
break;
}
}
const char *verb = cli.optarg();
const char *verb = cli.optArg();
ut_assert_true(verb == nullptr);
}
return true;