An xmlrpc test project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

70 lines
2.1 KiB

#include <unistd.h> /* for getopt */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "../include/appConfig.h"
int
handleCmdLine(tAppConfig * config, int argc, char *argv[])
{
int opt;
while ((opt = getopt(argc, argv, "Dvp:l:n:b:")) != -1) {
switch (opt) {
case 'p':
/* port */
config->port = atoi(optarg);
break;
case 'l':
/* logPath */
strncpy(config->logPath, optarg, sizeof(config->logPath)-1);
break;
case 'n':
/* logNamePattern */
strncpy(config->namePat, optarg, sizeof(config->namePat)-1);
break;
case 'b':
/* maxPending (connection backlog) */
config->maxPending = atoi(optarg);
break;
case 'v':
/* verbose */
config->verbose = 1;
break;
case 'D':
/* verbose */
config->doDaemon = 1;
break;
default:
/* '?' */
fprintf(
stderr,
"Usage: %s [-p port] [-l logPath] [-n logNamePattern] [-c maxClient] [-b backlog] [-v] [-D]\n"
"Defaults:\n"
"\t%-20s: port this service will use [%d]\n"
"\t%-20s: path where the logfiles will be stored [%s/]\n"
"\t%-20s: patten used by strftime to create the log filename [%s]\n"
"\t%-20s: maximum connection backlog [%d]\n"
"\t%-20s: be more verbose in syslog [off]\n"
"\t%-20s: deamonize me\n",
argv[0],
"-p port", DEFAULTPORT,
"-l logPath", DEFAULTPATH,
"-n logNamePattern", LOGNAMEPATTERN,
"-b backlog", MAXPENDING,
"-v",
"-D");
exit(EXIT_FAILURE);
}
}
return 0;
}