Well, actually that analysis really applies to the -x code (below).  For the invocation with a -i and no -x, you could just replace argv[i], which is "-i", with "-x" and record argv for use, with argv[0] replaced by the copy of the binary, as above with execv().  This would get rid of a whole heap of copying and counting of arguments.  The -x invocation would then just quietly ignore the configuration options that are irrelevant to it.