#include <cstdio>
#include "optparse.h"
int main(int argc, char** argv)
{ Options o; o.addOption("-h","--host","Remote hostname", OPT_REQUIRED | OPT_NEEDARG);
o.addOption("-p","--port","Remote port", OPT_REQUIRED | OPT_NEEDARG); Parser p; int result = p.parse(argc, argv, o); if ( result == E_OK )
{ char buf[1024];
snprintf(buf, sizeof(buf), "telnet %s %s", o.asString("-h").c_str(), o.asString("-p").c_str() );
buf[sizeof(buf)-1] = 0;
printf("\nRun: %s", buf);
}
else
{
printf("\nError parsing command line.");
}
printf("\n");
return 0;
}