Annotation of mqtt/src/mqttd.c, revision 1.1.1.1.2.2
1.1 misho 1: #include "global.h"
1.1.1.1.2.1 misho 2: #include "rtlm.h"
3:
4:
5: sl_config cfg;
1.1.1.1.2.2! misho 6: extern char compiled[], compiledby[], compilehost[];
! 7: int Verbose;
! 8:
! 9:
! 10: static void
! 11: Usage(void)
! 12: {
! 13: printf( " -= MQTT Broker =- MQTT Service from ELWIX\n"
! 14: "=== %s@%s === Compiled: %s ===\n\n"
! 15: "\t-c <config>\tService config\n"
! 16: "\t-v\t\tVerbose (more -vvv, more verbose)\n"
! 17: "\t-h\t\tHelp! This screen\n\n",
! 18: compiledby, compilehost, compiled);
! 19: }
1.1 misho 20:
21:
22: int
23: main(int argc, char **argv)
24: {
1.1.1.1.2.2! misho 25: char ch, szCfgName[MAXPATHLEN];
! 26:
! 27: strlcpy(szCfgName, DEFAULT_CONFIG, sizeof szCfgName);
! 28: while ((ch = getopt(argc, argv, "hvc:")) != -1)
! 29: switch (ch) {
! 30: case 'c':
! 31: strlcpy(szCfgName, optarg, sizeof szCfgName);
! 32: break;
! 33: case 'v':
! 34: Verbose++;
! 35: break;
! 36: case 'h':
! 37: default:
! 38: Usage();
! 39: return 1;
! 40: }
! 41: argc -= optind;
! 42: argv += optind;
! 43:
! 44: if (LoadConfig(szCfgName, &cfg)) {
! 45: printf("Error:: can't load #%d - %s\n", cfg_GetErrno(), cfg_GetError());
! 46: return 1;
! 47: }
! 48:
! 49: UnloadConfig(&cfg);
1.1 misho 50: return 0;
51: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>