diff options
| author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-06-20 11:08:56 +0200 | 
|---|---|---|
| committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-06-20 11:08:56 +0200 | 
| commit | 61fecfcd6f3e2e66e136c22195c38c99be8baa31 (patch) | |
| tree | 04af3ab71f8e3b31eb0412831b93e4d118a5c10f /src/exchange-lib | |
| parent | 6a8c5209c35470ac90b1f4d79d05e28bfa42c8ef (diff) | |
Put lookup logic for meta-commands.
Diffstat (limited to 'src/exchange-lib')
| -rw-r--r-- | src/exchange-lib/testing_api_loop.c | 24 | 
1 files changed, 23 insertions, 1 deletions
| diff --git a/src/exchange-lib/testing_api_loop.c b/src/exchange-lib/testing_api_loop.c index 7efadb39..03485068 100644 --- a/src/exchange-lib/testing_api_loop.c +++ b/src/exchange-lib/testing_api_loop.c @@ -57,11 +57,33 @@ TALER_TESTING_interpreter_lookup_command                  "Attempt to lookup command for empty label\n");      return NULL;    } -  for (unsigned int i=0;NULL != (cmd = &is->commands[i])->label;i++) +  for (unsigned int i=0; +       NULL != (cmd = &is->commands[i])->label; +       i++) +  { +    /* Give precedence to top-level commands.  */      if ( (NULL != cmd->label) &&           (0 == strcmp (cmd->label,                         label)) )        return cmd; + +    if (GNUNET_YES == cmd->meta) +    { +      struct TALER_TESTING_Command *batch = cmd->cls; + +      /* NOTE: the batch does need a "end" CMD in the +       * last place.  */ +      for (unsigned int i=0; +           NULL != (cmd = &batch[i])->label; +           i++)  +      { +        if ( (NULL != cmd->label) && +            (0 == strcmp (cmd->label, +                          label)) ) +          return cmd; +      } +    } +  }    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                "Command not found: %s\n",                label); | 
