title: expanding va_list portably
body: <p>I have a 3rd party function with signature:</p>
  
  <pre><code>int secretfoo(int numargs, ...);
  </code></pre>
  
  <p>I can call it directly, but what I really want is wrap it with my function that adds some extra arguments to it.</p>
  
  <p>Assume simple case of integers: I want calls <code>secretfoo(2, 10, 20)</code> to be translated as this: when I see argument 10 to duplicate it and make the call: <code>secretfoo(3, 10, 10, 20)</code>. I want to do it in wrapper:</p>
  
  <pre><code>int foowrapper(int numargs, ...);
  </code></pre>
  
  <p>This wrapper analyze argumetns and call <code>secretfoo</code> as described above.</p>
  
  <p>Can this be done in portably with <code>va_list</code> / <code>va_arg</code> etc.? Any other way?</p>