support: Add optstring support
commit244361ebaec57a6fbb9998bfa5ec71ee8d88f3e8
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 24 May 2017 12:17:34 +0000 (24 09:17 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 15 Jun 2017 19:01:38 +0000 (15 16:01 -0300)
treee98dba147ced72499f4754995d1556c7ba22404a
parent70fe2eb79417166c39a36699f591138bfe5c5307
support: Add optstring support

This patch adds an option to test to add small command line option
through CMDLINE_OPTSTRING define.  For instance:

  #define CMDLINE_OPTSTRING "vd"

  static void
  cmdline_process_function (int c)
  {
    switch (c):
      'v':
        /* process '-v' option.  */
      break;
      'd':
        /* process '-d' option.  */
      break;
  }
  #define CMDLINE_PROCESS cmdline_process_function

It will add both '-v' and '-d' along with already default long options.

* support/support_test_main.c (support_test_main):  Use optstring
member for option string in getopt_long.
* support/test-driver.c: Add comment about CMDLINE_OPTSTRING.
(CMDLINE_OPTSTRING): New define.
* support/test-driver.h (test_config): Add optstring member.
ChangeLog
support/support_test_main.c
support/test-driver.c
support/test-driver.h