public static void main(String args[]) {
		int c;
		int mode = 0;

		String inputFilename = null;

		// LongOpt[] longopts = new LongOpt[1];
		//
		// StringBuffer sb = new StringBuffer();
		// longopts[0] = new LongOpt("s", LongOpt.REQUIRED_ARGUMENT, null, 'z');

		Getopt g = new Getopt("parser", args, "vhm:c:o:s:p:r:x:i:z:");

		g.setOpterr(false);
		Hashtable params = new Hashtable();

		while ((c = g.getopt()) != -1) {
			switch (c) {

			case 'c':
				List clusters = new ArrayList();
				clusters.add(g.getOptarg());
				params.put(OPT_CLUSTER_NAME, clusters);
				break;

			case 'o':
				String outdir = g.getOptarg();
				params.put(OPT_OUTPUT_DIR, outdir);
				break;

			case 'r':
				params.put("it.telecomitalia.ah.zigbee.zcl.generator.generateRecords", Boolean.TRUE);
				break;

			case 'm':
				String modeName = g.getOptarg();
				if (modeName.equals("common")) {
					mode = 0;
				} else if (modeName.equals("zcl")) {
					mode = 1;
				} else {
					printUsage();
				}
				break;

			case 'i':
				String interfacesPackageName = g.getOptarg();
				params.put(OPT_INTERFACES_PACKAGE_NAME, interfacesPackageName);
				break;

			case 'z':
				String classesPackageName = g.getOptarg();
				params.put(OPT_ZCL_CLASSES_PACKAGE_NAME, classesPackageName);
				break;

			case 'x':
				params.put(OPT_GENERATE_PROXY_CLASSES, Boolean.TRUE);
				break;

			case 's':
				String xml = g.getOptarg();
				inputFilename = xml;
				break;

			case 'v':
				logInfo("version: " + version);
				return;

			case 'h':
				printUsage();
				return;

			default:
				System.out.println("getopt() returned " + c);
				break;
			}
		}

		zclGenerator = new ZclGenerator();

		try {
			zclGenerator.setInputFilename(inputFilename);
			zclGenerator.parse();
			zclGenerator.generate(mode, params);
		} catch (Exception e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
	}