File:  [ELWIX - Embedded LightWeight unIX -] / mqtt / src / mqttd.c
Revision 1.1.1.1.2.2: download - view: text, annotated - select for diffs - revision graph
Tue Nov 29 22:42:23 2011 UTC (12 years, 7 months ago) by misho
Branches: mqtt1_0
Diff to: branchpoint 1.1.1.1: preferred, unified
added 1st lines for mqttd

    1: #include "global.h"
    2: #include "rtlm.h"
    3: 
    4: 
    5: sl_config cfg;
    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: }
   20: 
   21: 
   22: int
   23: main(int argc, char **argv)
   24: {
   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);
   50: 	return 0;
   51: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>