Public feed #376894

if else mess

public java v1 · immutable
Raw Edit
·published 2007-03-01 10:31 UTC
rendered paste body
	private static String parseOptions(Properties options, String args[]) 	{		boolean host = false, port = false;		for (int n = 0; n < args.length; n++) {			if (args[n].equals("-config"))				if (!args[n + 1].startsWith("-"))					options.put("Main.config", args[++n]);				else					return "missing parameter for -config";			else if (args[n].equals("-plugins"))				if (!args[n + 1].startsWith("-"))					options.put("plugins", args[++n]);				else					return "missing parameter for -plugins";			else if (args[n].equals("-addplugin"))				if (!args[n + 1].startsWith("-"))					options.put("plugins", args[++n] + "," + options.get("plugins"));				else					return "missing parameter for -addplugin";			else if (args[n].equals("-term"))				if (!args[n + 1].startsWith("-"))					options.put("Terminal.id", args[++n]);				else					return "missing parameter for -term";			else if (!host) {				options.put("Socket.host", args[n]);				host = true;			} else if (host && !port) {				options.put("Socket.port", args[n]);				port = true;			} else				return "unknown parameter '" + args[n] + "'";		}		return null;	}