title: Convert an array into function parameters
body: <p>I register functions at a global registry. A function can have multiple arguments. I can register and call them from the registry. 
  Here is one of my unit tests to understand the registry. </p>
  
  <pre><code>void *a_test_function_d(int a, char *b){
      printf("*** c_test called\n");
      isRunD = a;
      testChar = b;
      return NULL;
  }
  
  TEST(testWithMultibleArguments) {
  isRunD = 0;
  testChar = "";
  
  add_command(a_test_function_d);
  assertEquals(1, avl_tree_count(command_registry));
  
  exec_command("a_test_function_d", 42, "test");   
  assertEquals(42, isRunD);
  assertEquals("test", testChar);
  
  avl_tree_free(command_registry);
      command_registry = NULL;
  }
  </code></pre>
  
  <p>This works fine for me so far. But here comes the part I can’t find a nice solution for. From a line-parser i get tokens. The first one should be the command, the following tokens are the arguments. If i would have a fixed length of arguments, than i doesn’t have any problems, but how can I construct a function or a macro that handles a variable count of tokens to pass them as arguments to a function? </p>
  
  <p>This is what i have so far:</p>
  
  <pre><code>    // split lines into tokens
      char *token;
      token = strtok(linebuffer," ");
      if (token) {
          if ( has_cammand(token) ) {
  
              // HOW TO PUT ARGS from strtok(linebuffer," ") to FUNCTION....
  
               exec_command(token /* , a1, a2, a3 */ );
           } else {
               uart_puts("Command not found.\n");
           }
       }
  </code></pre>
  
  <p>My line buffer is a char* and can look like:</p>
  
  <pre><code>find honigkuchen
  set name peter
  </code></pre>
  
  <p>(coming from a user input interactive shell).</p>
  
  <p>the prototypes of the functions would be:</p>
  
  <pre><code>void *find(char *);
  void *set(char *, char *);
  </code></pre>
  
  <p>Of cause I can define a macro and count <code>_VA_ARGS_</code>, or the array and do a if-else on 1, 2, 3, 4, … Parameters, but this seems a bit messy to me.
  There must be a better way to convert a array, to a parameter list.</p>