version 1.1.1.1.2.1, 2011/11/23 00:42:17
|
version 1.1.1.1.2.2, 2011/11/29 22:42:23
|
Line 3
|
Line 3
|
|
|
|
|
sl_config cfg; |
sl_config cfg; |
|
extern char compiled[], compiledby[], compilehost[]; |
|
int Verbose; |
|
|
|
|
|
static void |
|
Usage(void) |
|
{ |
|
printf( " -= MQTT Broker =- MQTT Service from ELWIX\n" |
|
"=== %s@%s === Compiled: %s ===\n\n" |
|
"\t-c <config>\tService config\n" |
|
"\t-v\t\tVerbose (more -vvv, more verbose)\n" |
|
"\t-h\t\tHelp! This screen\n\n", |
|
compiledby, compilehost, compiled); |
|
} |
|
|
|
|
int |
int |
main(int argc, char **argv) |
main(int argc, char **argv) |
{ |
{ |
|
char ch, szCfgName[MAXPATHLEN]; |
|
|
|
strlcpy(szCfgName, DEFAULT_CONFIG, sizeof szCfgName); |
|
while ((ch = getopt(argc, argv, "hvc:")) != -1) |
|
switch (ch) { |
|
case 'c': |
|
strlcpy(szCfgName, optarg, sizeof szCfgName); |
|
break; |
|
case 'v': |
|
Verbose++; |
|
break; |
|
case 'h': |
|
default: |
|
Usage(); |
|
return 1; |
|
} |
|
argc -= optind; |
|
argv += optind; |
|
|
|
if (LoadConfig(szCfgName, &cfg)) { |
|
printf("Error:: can't load #%d - %s\n", cfg_GetErrno(), cfg_GetError()); |
|
return 1; |
|
} |
|
|
|
UnloadConfig(&cfg); |
return 0; |
return 0; |
} |
} |